Module: JSONAPIonify::Api::Resource::ErrorHandling
- Extended by:
- ActiveSupport::Concern
- Included in:
- JSONAPIonify::Api::Resource
- Defined in:
- lib/jsonapionify/api/resource/error_handling.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #error(name, *args, &block) ⇒ Object
- #error_meta ⇒ Object
- #error_now(name, *args, &block) ⇒ Object
- #halt ⇒ Object
- #set_errors(collection) ⇒ Object
Instance Method Details
#error(name, *args, &block) ⇒ Object
94 95 96 97 98 99 100 101 |
# File 'lib/jsonapionify/api/resource/error_handling.rb', line 94 def error(name, *args, &block) errors.evaluate( *args, error_block: lookup_error(name), runtime_block: block, backtrace: caller ) end |
#error_meta ⇒ Object
112 113 114 |
# File 'lib/jsonapionify/api/resource/error_handling.rb', line 112 def errors. end |
#error_now(name, *args, &block) ⇒ Object
103 104 105 106 |
# File 'lib/jsonapionify/api/resource/error_handling.rb', line 103 def error_now(name, *args, &block) error(name, *args, &block) halt end |
#halt ⇒ Object
116 117 118 119 120 |
# File 'lib/jsonapionify/api/resource/error_handling.rb', line 116 def halt error = Errors::RequestError.new error.set_backtrace caller raise error end |
#set_errors(collection) ⇒ Object
108 109 110 |
# File 'lib/jsonapionify/api/resource/error_handling.rb', line 108 def set_errors(collection) errors.set collection end |