/
exceptions.rb
91 lines (62 loc) · 3.47 KB
/
exceptions.rb
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module Sequel
# Represents an error raised in Sequel code.
class Error < StandardError
# Rollback is a special error used to rollback a transactions.
# A transaction block will catch this error and wont pass further up the stack.
class Rollback < Error ; end
# Represents an invalid value stored in the database.
class InvalidValue < Error ; end
# Represents invalid arguments p assed to sequel methods.
class Argument < Error ; end
# Represents Invalid parameters passed to a sequel method.
class InvalidParameters < Error ; end
# Represents an Invalid transfor m.
class InvalidTransform < Error ; end
# Represents an Invalid filter.
class InvalidFilter < Error ; end
# Represents a failure to provid e a connection proc for the connection pool.
class NoConnectionProc < Error ; end
# Represents missing a required connection string.
class NoConnectionString < Error ; end
# Represents an attempt to perfo rming filter operations when no filter has been specified yet.
class NoExistingFilter < Error ; end
# Represents an invalid join typ e.
class InvalidJoinType < Error ; end
# Represents an attempt to perfo rm an update on a grouped dataset.
class UpdateGroupedDataset < Error ; end
# Represents an attempt to perfo rm an update on a joined dataset.
class UpdateJoinedDataset < Error ; end
# Represents an attempt to perfo rm an delete from a grouped dataset.
class DeleteGroupedDataset < Error ; end
# Represents an attempt to perfo rm an delete from a joined dataset.
class DeleteJoinedDataset < Error ; end
class InvalidMigrationDirection < Error ; end
class NoCurrentVersionAvailable < Error ; end
class NoTargetVersionAvailable < Error ; end
class OffsetNotSupported < Error ; end
# Represents a model that has no associated dataset.
class NoDatasetAssociatedWithModel < Error ; end
# Represents a model with no primary key specified.
class NoPrimaryKeyForModel < Error ; end
class UnsupportedMatchPatternClass < Error ; end
class Index < Error ; end
class Name < Error ; end
class InvalidExpression < Error ; end
class InvalidExpressionTree < Error ; end
class ChainBroken < RuntimeError ; end
class WorkerStopError < RuntimeError ; end
end
end
# Object extensions
class Object
# Cancels the current transaction without an error:
#
# DB.tranaction do
# ...
# rollback! if failed_to_contact_client
# ...
# end
def rollback!
raise Sequel::RollbackError
end
end