Module: Zen::Service::Plugins::Rescue
- Extended by:
- Plugin
- Defined in:
- lib/zen/service/plugins/rescue.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Plugin
config, default_options, extended, register_as, service_extension
Class Method Details
.used(service_class) ⇒ Object
8
9
10
11
|
# File 'lib/zen/service/plugins/rescue.rb', line 8
def self.used(service_class, *)
service_class.use(:status) unless service_class.using?(:status)
service_class.add_execution_prop(:error)
end
|
Instance Method Details
#error ⇒ Object
25
26
27
|
# File 'lib/zen/service/plugins/rescue.rb', line 25
def error
state.error
end
|
#error? ⇒ Boolean
29
30
31
|
# File 'lib/zen/service/plugins/rescue.rb', line 29
def error?
status == :error
end
|
#execute(**opts) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/zen/service/plugins/rescue.rb', line 13
def execute(**opts)
rezcue = opts.delete(:rescue)
super
rescue StandardError => e
clear_execution_state!
failure!(status: :error)
state.error = e
raise e unless rezcue
self
end
|