Class: Errorgap::Notice
- Inherits:
-
Object
- Object
- Errorgap::Notice
- Defined in:
- lib/errorgap/notice.rb
Constant Summary collapse
- SOURCE_RADIUS =
Lines of context shipped either side of the failing line for in-app frames, and a cap on how many frames include an excerpt so deep backtraces don't inflate the payload.
6- MAX_SOURCE_FRAMES =
25- MAX_SOURCE_LINE_LENGTH =
400
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(error:, configuration:, context:, environment:, session:, params:) ⇒ Notice
constructor
A new instance of Notice.
- #to_h ⇒ Object
Constructor Details
#initialize(error:, configuration:, context:, environment:, session:, params:) ⇒ Notice
Returns a new instance of Notice.
25 26 27 28 29 30 31 32 |
# File 'lib/errorgap/notice.rb', line 25 def initialize(error:, configuration:, context:, environment:, session:, params:) @error = error @configuration = configuration @context = context || {} @environment = environment || {} @session = session || {} @params = params || {} end |
Class Method Details
.from_exception(error, configuration:, context: {}, environment: {}, session: {}, params: {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/errorgap/notice.rb', line 14 def self.from_exception(error, configuration:, context: {}, environment: {}, session: {}, params: {}) new( error: error, configuration: configuration, context: context, environment: environment, session: session, params: params ) end |
Instance Method Details
#to_h ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/errorgap/notice.rb', line 34 def to_h { project_id: @configuration.project_id, received_at: Time.now.utc.iso8601, errors: [ { type: @error.class.name, message: @error..to_s, backtrace: backtrace_frames } ], context: default_context.merge(stringify_hash(@context)), environment: stringify_hash(@environment), session: stringify_hash(@session), params: filter_hash(@params) } end |