Class: Airbrake::NestedException Private
- Inherits:
-
Object
- Object
- Airbrake::NestedException
- Defined in:
- lib/airbrake-ruby/nested_exception.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A class that is capable of unwinding nested exceptions and representing them as JSON-like hash.
Constant Summary collapse
- MAX_NESTED_EXCEPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns the maximum number of nested exceptions that a notice can unwrap. Exceptions that have a longer cause chain will be ignored.
3
- RUBY_31_ERROR_HIGHLIGHTING_DIVIDER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
On Ruby 3.1+, the error highlighting gem can produce messages that can span multiple lines. We don’t display multiline error messages in the title of the notice in the Airbrake dashboard. Therefore, we want to strip out the higlighting part so that the errors look consistent. The full message with the exception will be attached to the notice body.
"\n\n".freeze
- ENCODING_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns the options for String#encode.
{ invalid: :replace, undef: :replace }.freeze
Instance Method Summary collapse
- #as_json ⇒ Object private
-
#initialize(exception) ⇒ NestedException
constructor
private
A new instance of NestedException.
Constructor Details
#initialize(exception) ⇒ NestedException
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NestedException.
24 25 26 |
# File 'lib/airbrake-ruby/nested_exception.rb', line 24 def initialize(exception) @exception = exception end |
Instance Method Details
#as_json ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 34 |
# File 'lib/airbrake-ruby/nested_exception.rb', line 28 def as_json unwind_exceptions.map do |exception| { type: exception.class.name, message: (exception), backtrace: Backtrace.parse(exception) } end end |