Skip to content

Commit

Permalink
Add original class to the message
Browse files Browse the repository at this point in the history
  • Loading branch information
drewhoskins-stripe committed Sep 28, 2021
1 parent 6abbdad commit 3dbd0a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/temporal/workflow/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ class Errors
def self.generate_error(failure, default_exception_class = StandardError)
case failure.failure_info
when :application_failure_info
message = from_details_payloads(failure.application_failure_info.details)

exception_class = safe_constantize(failure.application_failure_info.type)
fallback_to_default = false
if exception_class.nil?
Temporal.logger.error(
"Could not find original error class. Defaulting to StandardError.",
{original_error: failure.application_failure_info.type},
)
message = "#{failure.application_failure_info.type}: #{message}"
exception_class = default_exception_class
end

message = from_details_payloads(failure.application_failure_info.details)

begin
exception = exception_class.new(message)
rescue ArgumentError => deserialization_error
# We don't currently support serializing/deserializing exceptions with more than one argument.
message = "#{exception_class}: #{message}"
exception = default_exception_class.new(message)
Temporal.logger.error(
"Could not instantiate original error. Defaulting to StandardError.",
Expand Down

0 comments on commit 3dbd0a0

Please sign in to comment.