Class: Checkend::NoticeBuilder
- Inherits:
-
Object
- Object
- Checkend::NoticeBuilder
- Defined in:
- lib/checkend/notice_builder.rb
Overview
NoticeBuilder converts Ruby exceptions into Notice objects.
It handles backtrace cleaning, context merging, and user info extraction.
Constant Summary collapse
- MAX_BACKTRACE_LINES =
100- MAX_MESSAGE_LENGTH =
10_000
Class Method Summary collapse
-
.build(exception:, context: {}, request: nil, user: nil, fingerprint: nil, tags: []) ⇒ Notice
Build a Notice from an exception.
Class Method Details
.build(exception:, context: {}, request: nil, user: nil, fingerprint: nil, tags: []) ⇒ Notice
Build a Notice from an exception
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/checkend/notice_builder.rb', line 22 def build(exception:, context: {}, request: nil, user: nil, fingerprint: nil, tags: []) notice = Notice.new # Error info notice.error_class = exception.class.name notice. = (exception.) notice.backtrace = clean_backtrace(exception.backtrace || []) notice.fingerprint = fingerprint notice. = Array() # Merge thread-local context with provided context notice.context = merge_context(context) notice.user = user || thread_local_user notice.request = request || {} # Environment notice.environment = Checkend.configuration.environment notice end |