lib/acts_as_approvable/error.rb in acts-as-approvable-0.6.8.1 vs lib/acts_as_approvable/error.rb in acts-as-approvable-0.6.9
- old
+ new
@@ -2,30 +2,33 @@
class Error < RuntimeError
##
# Raised when a locked approval is accepted or rejected.
class Locked < ActsAsApprovable::Error
def initialize(*args)
- args[0] = 'this approval is locked'
- super(*args)
+ super('this approval is locked')
end
end
##
# Raised when a stale approval is accepted.
class Stale < ActsAsApprovable::Error
def initialize(*args)
- args[0] = 'this approval is stale and should not be approved'
- super(*args)
+ super('this approval is stale and should not be approved')
end
end
##
# Raised when a record is assigned as owner that is not found in
# {ActsAsApprovable::Ownership::ClassMethods#available_owners}.
class InvalidOwner < ActsAsApprovable::Error
def initialize(*args)
- args[0] = 'this record cannot be assigned as an owner'
- super(*args)
+ super('this record cannot be assigned as an owner')
+ end
+ end
+
+ class InvalidTransition < ActsAsApprovable::Error
+ def initialize(from, to, approval)
+ super("you may not transition from #{from} to #{to} in a #{approval.event} approval")
end
end
end
end