Exception: Hooks::Plugins::Handlers::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Hooks::Plugins::Handlers::Error
- Defined in:
- lib/hooks/plugins/handlers/error.rb
Overview
Custom exception class for handler errors
This exception is used when handlers call the ‘error!` method to immediately terminate request processing and return a specific error response. It carries the error details back to the Grape API context where it can be properly formatted and returned to the client.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
The error body/data to return to the client.
-
#status ⇒ Integer
readonly
The HTTP status code to return.
Instance Method Summary collapse
-
#initialize(body, status = 500) ⇒ Error
constructor
Initialize a new handler error.
Constructor Details
#initialize(body, status = 500) ⇒ Error
Initialize a new handler error
28 29 30 31 32 |
# File 'lib/hooks/plugins/handlers/error.rb', line 28 def initialize(body, status = 500) @body = body @status = status.to_i super("Handler error: #{status} - #{body}") end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns The error body/data to return to the client.
19 20 21 |
# File 'lib/hooks/plugins/handlers/error.rb', line 19 def body @body end |
#status ⇒ Integer (readonly)
Returns The HTTP status code to return.
22 23 24 |
# File 'lib/hooks/plugins/handlers/error.rb', line 22 def status @status end |