-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
error.cr
48 lines (37 loc) · 949 Bytes
/
error.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module DB
abstract class Connection
end
class Error < Exception
end
class MappingException < Error
end
class PoolTimeout < Error
end
class PoolRetryAttemptsExceeded < Error
end
class PoolResourceLost(T) < Error
getter resource : T
def initialize(@resource : T)
end
end
class PoolResourceRefused < Error
end
# Raised when an established connection is lost
# probably due to socket/network issues.
# It is used by the connection pool retry logic.
class ConnectionLost < PoolResourceLost(Connection)
def connection
resource
end
end
# Raised when a connection is unable to be established
# probably due to socket/network or configuration issues.
# It is used by the connection pool retry logic.
class ConnectionRefused < PoolResourceRefused
end
class Rollback < Error
end
# Raised when a scalar query returns no results.
class NoResultsError < Error
end
end