Module: LightServiceExt::WithErrorHandler

Included in:
ApplicationOrganizer, RecordActions
Defined in:
lib/light-service-ext/with_error_handler.rb

Instance Method Summary collapse

Instance Method Details

#with_error_handler(ctx:) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/light-service-ext/with_error_handler.rb', line 6

def with_error_handler(ctx:)
  @result = yield || ctx
rescue StandardError => e
  ctx.record_raised_error(e)
  ctx.add_status(Status::COMPLETE)
  ctx.fail!
  ctx
end