module Sentry
def with_exception_captured(**options, &block)
end
1/0 #=> ZeroDivisionError will be reported and re-raised
Sentry.with_exception_captured do
end
1/1 #=> 1 will be returned
Sentry.with_exception_captured do
@example
If the block ran without exception, it returns the evaluation result.
Takes a block and evaluates it. If the block raised an exception, it reports the exception to Sentry and re-raises it.
def with_exception_captured(**options, &block) yield rescue Exception => e capture_exception(e, **options) raise end