lib/sequel/model/exceptions.rb in sequel-4.21.0 vs lib/sequel/model/exceptions.rb in sequel-4.22.0
- old
+ new
@@ -14,14 +14,18 @@
# Alias for HookFailed, kept for backwards compatibility
BeforeHookFailed = HookFailed
# Exception class raised when +require_modification+ is set and an UPDATE or DELETE statement to modify the dataset doesn't
# modify a single row.
- class NoExistingObject < Error; end
+ NoExistingObject = Class.new(Error)
# Raised when an undefined association is used when eager loading.
- class UndefinedAssociation < Error; end
+ UndefinedAssociation = Class.new(Error)
+
+ # Raised when a mass assignment method is called in strict mode with either a restricted column
+ # or a column without a setter method.
+ MassAssignmentRestriction = Class.new(Error)
# Exception class raised when +raise_on_save_failure+ is set and validation fails
class ValidationFailed < Error
# The Sequel::Model object related to this exception.
attr_reader :model
@@ -40,7 +44,12 @@
super(errors.full_messages.join(', '))
else
super
end
end
+ end
+
+ # Call name on each class to set the name for the class, so it gets cached.
+ constants.map{|c| const_get(c)}.each do |c|
+ Class === c && c.name
end
end