Exception: Eluvia::Errors::StandardError
- Defined in:
- lib/eluvia/errors/standard_error.rb
Direct Known Subclasses
BadRequest, Forbidden, NotFound, ServiceUnavailable, Unauthorized, UnprocessableEntity
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#no_sentry ⇒ Object
readonly
Returns the value of attribute no_sentry.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(message = nil, error = nil, status = nil, source = nil, no_sentry = false) ⇒ StandardError
constructor
A new instance of StandardError.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(message = nil, error = nil, status = nil, source = nil, no_sentry = false) ⇒ StandardError
Returns a new instance of StandardError.
7 8 9 10 11 12 13 14 15 |
# File 'lib/eluvia/errors/standard_error.rb', line 7 def initialize( = nil, error = nil, status = nil, source = nil, no_sentry = false) super() @message = || "We encountered unexpected error, but our developers had been already notified about it" @error = error || "Internal Server Error" @status = status || 500 @source = source @timestamp = Time.current @no_sentry = no_sentry end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/eluvia/errors/standard_error.rb', line 5 def error @error end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/eluvia/errors/standard_error.rb', line 5 def @message end |
#no_sentry ⇒ Object (readonly)
Returns the value of attribute no_sentry.
5 6 7 |
# File 'lib/eluvia/errors/standard_error.rb', line 5 def no_sentry @no_sentry end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/eluvia/errors/standard_error.rb', line 5 def source @source end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/eluvia/errors/standard_error.rb', line 5 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/eluvia/errors/standard_error.rb', line 5 def @timestamp end |
Instance Method Details
#to_h ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/eluvia/errors/standard_error.rb', line 17 def to_h { message: , error: error, status: status, source: source, timestamp: } end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/eluvia/errors/standard_error.rb', line 27 def to_s to_h.to_s end |