Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #694 from scientist-softserv/less_useless_status
Browse files Browse the repository at this point in the history
improve the message sent to the mailboxer for failed binarys on files
  • Loading branch information
jeremyf authored Dec 4, 2023
2 parents 8a052bd + 3cf162d commit 432fbcf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/jobs/import_url_job_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def copy_remote_file(uri, name, headers = {})
Rails.logger.error(
%(ImportUrlJob: Error copying <#{uri}> to #{dir} with #{e.message}. #{e.backtrace.join("\n")})
)
send_error(e.message)
send_error(e.message + e.backtrace.join("\n"))
# TODO: Should we re-raise the exception? As written this copy_remote_file has a false
# success.
end
Expand All @@ -26,10 +26,14 @@ def copy_remote_file(uri, name, headers = {})
end

# OVERRIDE there are calls to send_error that send two arguments.
# also give us the fileset with the error
#
# @see https://github.com/samvera/hyrax/blob/426575a9065a5dd3b30f458f5589a0a705ad7be2/app/jobs/import_url_job.rb#L76-L105
def send_error(error_message, *)
super(error_message)
user = User.find_by_user_key(file_set.depositor)
@file_set.errors.add("Error for file_set #{@file_set.id}:", error_message)
Hyrax.config.callback.run(:after_import_url_failure, @file_set, user)
@operation.fail!(@file_set.errors.full_messages.join(' '))
end
end

Expand Down

0 comments on commit 432fbcf

Please sign in to comment.