-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcaller.rb
More file actions
35 lines (29 loc) · 889 Bytes
/
caller.rb
File metadata and controls
35 lines (29 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true
# rubocop:disable Lint/RescueException
class Solid::Process
module Caller
def call(arg = nil)
output_already_set! if output?
self.input = arg
run_callbacks(:call) do
::Solid::Result.event_logs(name: self.class.name) do
self.output =
if dependencies&.invalid?
Failure(:invalid_dependencies, dependencies: dependencies)
elsif input.invalid?
Failure(:invalid_input, input: input)
else
super(input.attributes.symbolize_keys)
end
rescue ::Exception => exception
rescue_with_handler(exception) || raise
output
end
end
run_callbacks(:success) if output.success?
run_callbacks(:failure) if output.failure?
output
end
end
end
# rubocop:enable Lint/RescueException