Exception: Operations::Errors::InvalidOperationError
- Inherits:
-
BaseException
- Object
- StandardError
- BaseException
- Operations::Errors::InvalidOperationError
- Defined in:
- lib/operations/errors/invalid_operation_error.rb
Instance Method Summary collapse
-
#initialize(operation, msg = nil) ⇒ InvalidOperationError
constructor
A new instance of InvalidOperationError.
Constructor Details
#initialize(operation, msg = nil) ⇒ InvalidOperationError
Returns a new instance of InvalidOperationError.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/operations/errors/invalid_operation_error.rb', line 4 def initialize(operation, msg=nil) if operation.class == Operations::Operation cause = "Cause:" has_cause = false unless operation.has_valid_name? cause += " invalid name" has_cause = true end unless operation.has_valid_scope? cause += " invalid scope `#{operation.invalid_scope}'" has_cause = true end cause "Unknown cause." unless has_cause = "The operation #{operation} is not valid. #{cause}" else = "Invalid operation object. Cause: `#{operation}'." end += " Additional info: #{msg}" if msg super() end |