Module: Tinymon::Integrations
- Defined in:
- lib/tinymon/integrations.rb
Overview
Capture unhandled exceptions at process exit. Ruby doesn’t have a true global “uncaught exception” hook the way Python (sys.excepthook) or Java (Thread.setDefaultUncaughtExceptionHandler) do — the closest equivalent is checking $! inside an at_exit block, which fires after a fatal exception has propagated out of ‘main`.
Class Method Summary collapse
Class Method Details
.install(client) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tinymon/integrations.rb', line 12 def install(client) at_exit do exc = $! # rubocop:disable Style/SpecialGlobalVars # SystemExit is normal program exit; ignore it. if exc && !exc.is_a?(SystemExit) begin client.capture_exception(exc) rescue StandardError # swallow end end end end |