Class: OReflect::Error
- Inherits:
-
Object
- Object
- OReflect::Error
- Includes:
- Accessors
- Defined in:
- lib/oreflect/error.rb
Constant Summary collapse
- DEFAULT_ERRORS =
lambda do error 500 do title 'Application Error' desc 'An error occurred on the server' end error 503 do title 'Down For Maintenance' desc 'The service is temporarily unavailable due to maintenance' end error 404 do title 'Resource Not Found' desc 'The resource you identified does not exist on the server' end error 403 do title 'Authorization Required' desc 'You need to authenticate to access the resource' end error 400 do title 'Invalid Request' desc 'One or more params were malformed and the server has rejected the request' end end
Instance Method Summary collapse
- #as_hash ⇒ Object
-
#initialize(code, &block) ⇒ Error
constructor
A new instance of Error.
Methods included from Accessors
Constructor Details
#initialize(code, &block) ⇒ Error
Returns a new instance of Error.
36 37 38 39 |
# File 'lib/oreflect/error.rb', line 36 def initialize(code, &block) @code = code instance_eval(&block) if block_given? end |
Instance Method Details
#as_hash ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/oreflect/error.rb', line 41 def as_hash h = {} h[:code] = code h[:description] = description h[:title] = title h end |