1: <?php
2:
3: /**
4: * This file is part of the Kdyby (http://www.kdyby.org)
5: *
6: * Copyright (c) 2008 Filip Procházka (filip@prochazka.su)
7: *
8: * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
9: */
10:
11: namespace Kdyby\Redis;
12:
13:
14:
15: /**
16: * @author Filip Procházka <filip@prochazka.su>
17: */
18: interface Exception
19: {
20:
21: }
22:
23:
24:
25: /**
26: * @author Filip Procházka <filip@prochazka.su>
27: */
28: class InvalidArgumentException extends \InvalidArgumentException implements Exception
29: {
30:
31: }
32:
33:
34:
35: /**
36: * @author Filip Procházka <filip@prochazka.su>
37: */
38: class MissingExtensionException extends \RuntimeException implements Exception
39: {
40:
41: }
42:
43:
44:
45: /**
46: * @author Filip Procházka <filip@prochazka.su>
47: */
48: class ConnectionException extends \RuntimeException implements Exception
49: {
50:
51: }
52:
53:
54:
55: /**
56: * @author Filip Procházka <filip@prochazka.su>
57: */
58: class SessionHandlerException extends \RuntimeException implements Exception
59: {
60:
61: }
62:
63:
64:
65: /**
66: * @author Filip Procházka <filip@prochazka.su>
67: */
68: class RedisClientException extends \RuntimeException implements Exception
69: {
70:
71: /**
72: * @var string
73: */
74: public $request;
75:
76: /**
77: * @var string
78: */
79: public $response;
80:
81: }
82:
83:
84:
85: /**
86: * @author Filip Procházka <filip@prochazka.su>
87: */
88: class TransactionException extends RedisClientException implements Exception
89: {
90:
91: }
92:
93:
94:
95: /**
96: * @author Filip Procházka <filip@prochazka.su>
97: */
98: class LockException extends RedisClientException
99: {
100:
101: const PROCESS_TIMEOUT = 1;
102: const ACQUIRE_TIMEOUT = 2;
103:
104:
105:
106: /**
107: * @return LockException
108: */
109: public static function highConcurrency()
110: {
111: return new static("Lock couldn't be acquired. Concurrency is way too high. I died of old age.", self::PROCESS_TIMEOUT);
112: }
113:
114:
115:
116: /**
117: * @return LockException
118: */
119: public static function acquireTimeout()
120: {
121: return new static("Lock couldn't be acquired. The locking mechanism is giving up. You should kill the request.", self::ACQUIRE_TIMEOUT);
122: }
123:
124:
125:
126: /**
127: * @return LockException
128: */
129: public static function durabilityTimedOut()
130: {
131: return new static("Process ran too long. Increase lock duration, or extend lock regularly.");
132: }
133:
134:
135:
136: /**
137: * @return LockException
138: */
139: public static function invalidDuration()
140: {
141: return new static("Some rude client have messed up the lock duration.");
142: }
143:
144: }
145: