Class: GraphitiErrors::InvalidRequest::ExceptionHandler
- Inherits:
-
ExceptionHandler
- Object
- ExceptionHandler
- GraphitiErrors::InvalidRequest::ExceptionHandler
- Defined in:
- lib/graphiti_errors/invalid_request/exception_handler.rb
Instance Attribute Summary
Attributes inherited from ExceptionHandler
Instance Method Summary collapse
- #error_payload(error) ⇒ Object
-
#initialize(options = {}) ⇒ ExceptionHandler
constructor
A new instance of ExceptionHandler.
- #status_code(error) ⇒ Object
Methods inherited from ExceptionHandler
#backtrace_cleaner, #detail, #error_code, #log, #log?, #meta, #title
Constructor Details
#initialize(options = {}) ⇒ ExceptionHandler
Returns a new instance of ExceptionHandler.
4 5 6 7 8 9 10 11 12 |
# File 'lib/graphiti_errors/invalid_request/exception_handler.rb', line 4 def initialize( = {}) unless .key?(:log) [:log] = false end super @show_raw_error = log? end |
Instance Method Details
#error_payload(error) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/graphiti_errors/invalid_request/exception_handler.rb', line 18 def error_payload(error) serializer = InvalidRequest::Serializer.new(error.errors) { errors: serializer.rendered_errors, } end |
#status_code(error) ⇒ Object
14 15 16 |
# File 'lib/graphiti_errors/invalid_request/exception_handler.rb', line 14 def status_code(error) 400 end |