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- MAX_CAUSE_DEPTH =
10
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(error:, configuration:, context:, environment:, session:, params:, breadcrumbs: []) ⇒ Notice
constructor
A new instance of Notice.
- #to_h ⇒ Object
Constructor Details
#initialize(error:, configuration:, context:, environment:, session:, params:, breadcrumbs: []) ⇒ Notice
Returns a new instance of Notice.
27 28 29 30 31 32 33 34 35 |
# File 'lib/errorgap/notice.rb', line 27 def initialize(error:, configuration:, context:, environment:, session:, params:, breadcrumbs: []) @error = error @configuration = configuration @context = context || {} @environment = environment || {} @session = session || {} @params = params || {} @breadcrumbs = Array() end |
Class Method Details
.from_exception(error, configuration:, context: {}, environment: {}, session: {}, params: {}, breadcrumbs: []) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/errorgap/notice.rb', line 15 def self.from_exception(error, configuration:, context: {}, environment: {}, session: {}, params: {}, breadcrumbs: []) new( error: error, configuration: configuration, context: context, environment: environment, session: session, params: params, breadcrumbs: ) end |
Instance Method Details
#to_h ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/errorgap/notice.rb', line 37 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 |