Module: BloodContracts::Core::ExceptionHandling
- Included in:
- BloodContracts::Core::Ext::Refined
- Defined in:
- lib/blood_contracts/core/exception_handling.rb
Overview
Concern to wrap matching process with exception handling
Instance Method Summary collapse
-
#exception(exc, context: @context) ⇒ ExceptionCaught
Wraps the exception in refinement type.
-
#match ⇒ Refined
Runs the matching process and returns an ExceptionCaught if StandardError happened inside match call.
Instance Method Details
#exception(exc, context: @context) ⇒ ExceptionCaught
Wraps the exception in refinement type
32 33 34 |
# File 'lib/blood_contracts/core/exception_handling.rb', line 32 def exception(exc, context: @context) ExceptionCaught.new(exc, context: context) end |
#match ⇒ Refined
Runs the matching process and returns an ExceptionCaught if StandardError happened inside match call
20 21 22 23 24 |
# File 'lib/blood_contracts/core/exception_handling.rb', line 20 def match super rescue StandardError => ex exception(ex) end |