Exception: Spikard::Errors::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Spikard::Errors::Error
- Defined in:
- lib/spikard/errors.rb
Direct Known Subclasses
ConflictError, ForbiddenError, InternalError, NotFoundError, RateLimitedError, UnauthorizedError, ValidationError
Instance Attribute Summary collapse
-
#problem_details_type ⇒ Object
readonly
Returns the value of attribute problem_details_type.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message = nil, status_code: nil, problem_details_type: nil) ⇒ Error
constructor
A new instance of Error.
- #to_problem_details ⇒ Object
Constructor Details
#initialize(message = nil, status_code: nil, problem_details_type: nil) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 |
# File 'lib/spikard/errors.rb', line 8 def initialize( = nil, status_code: nil, problem_details_type: nil) super() @status_code = status_code @problem_details_type = problem_details_type end |
Instance Attribute Details
#problem_details_type ⇒ Object (readonly)
Returns the value of attribute problem_details_type.
6 7 8 |
# File 'lib/spikard/errors.rb', line 6 def problem_details_type @problem_details_type end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
6 7 8 |
# File 'lib/spikard/errors.rb', line 6 def status_code @status_code end |
Instance Method Details
#to_problem_details ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/spikard/errors.rb', line 14 def to_problem_details { type: @problem_details_type || "about:blank", title: self.class.name.split("::").last, status: @status_code || 500, detail: } end |