Sha256: 291727d9e19209f20be1894437f6347afb1d211747c25140a76813d9c9521922
Contents?: true
Size: 704 Bytes
Versions: 7
Compression:
Stored size: 704 Bytes
Contents
# frozen_string_literal: true # rubocop:disable Metrics/AbcSize module LightServiceExt module WithErrorHandler def with_error_handler(ctx:) @result = yield || ApplicationContext.make_with_defaults rescue Rails::ActiveRecordError => e error_info = ErrorInfo.new(e, fatal: false) ctx.add_internal_only(error_info: error_info) ctx.add_errors(**error_info.errors) LightServiceExt.config.logger.error(error_info.error_summary) ctx.fail! ctx rescue StandardError => e error_info = ErrorInfo.new(e, fatal: false) LightServiceExt.config.logger.error(error_info.error_summary) raise end end end # rubocop:enable Metrics/AbcSize
Version data entries
7 entries across 7 versions & 1 rubygems