Exception: Interceptors::AppError
- Inherits:
-
StandardError
- Object
- StandardError
- Interceptors::AppError
- Defined in:
- lib/interceptors/app_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
Instance Method Summary collapse
-
#initialize(message = "Application error", code: "app_error", http_status: 400, details: {}) ⇒ AppError
constructor
A new instance of AppError.
- #to_h ⇒ Object
Constructor Details
#initialize(message = "Application error", code: "app_error", http_status: 400, details: {}) ⇒ AppError
Returns a new instance of AppError.
7 8 9 10 11 12 |
# File 'lib/interceptors/app_error.rb', line 7 def initialize( = "Application error", code: "app_error", http_status: 400, details: {}) super() @code = code @http_status = http_status @details = details || {} end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/interceptors/app_error.rb', line 5 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
5 6 7 |
# File 'lib/interceptors/app_error.rb', line 5 def details @details end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
5 6 7 |
# File 'lib/interceptors/app_error.rb', line 5 def http_status @http_status end |
Instance Method Details
#to_h ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/interceptors/app_error.rb', line 14 def to_h { message: , code: code, http_status: http_status, details: details } end |