Skip to content

Commit

Permalink
Merge pull request #8748 from CitizenLabDotCo/TAN-2469-check-for-fara…
Browse files Browse the repository at this point in the history
…day-error-class

[TAN-2469] Check for specific error class, not has_attribute?
  • Loading branch information
jinjagit authored Aug 22, 2024
2 parents 7a6fc28 + 54a367d commit e8f483f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def execute(plan)
task.set_succeeded!
rescue SummarizationFailedError, Faraday::BadRequestError => e
extra = {}
if e.has_attribute?(:response)
if e.instance_of?('Faraday::BadRequestError')
extra[:response] = e&.response
extra[:response_headers] = e&.response&.headers
extra[:response_body] = e&.response&.body
extra[:response_status] = e&.response&.status
extra[:backtrace] = e&.backtrace if e.has_attribute?(:backtrace)
extra[:backtrace] = e&.backtrace
end

ErrorReporter.report(e, extra: extra)
Expand Down

0 comments on commit e8f483f

Please sign in to comment.