Exception: RfcReader::ErrorContext::ContextError

Inherits:
StandardError
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rfc_reader/error_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cause:, context: nil) ⇒ ContextError

Returns a new instance of ContextError.

Parameters:

  • cause (StandardError)
  • context (String) (defaults to: nil)

    (Optional)



16
17
18
19
20
# File 'lib/rfc_reader/error_context.rb', line 16

def initialize(cause:, context: nil)
  @cause = cause
  @context = context || default_context
  super
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



10
11
12
# File 'lib/rfc_reader/error_context.rb', line 10

def context
  @context
end

Instance Method Details

#full_messageObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rfc_reader/error_context.rb', line 26

def full_message
  "    Context:\n    \#{indent(@context)}\n    Error:\n       \#{@cause.class}\n    Message:\n    \#{indent(message)}\n    Backtrace:\n    \#{indent(backtrace)}\n  MESSAGE\nend\n"

#short_messageObject



22
23
24
# File 'lib/rfc_reader/error_context.rb', line 22

def short_message
  "Error: #{context}"
end