This repository is currently being migrated. It's locked while the migration is in progress.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ def show
2828 end
2929
3030 def download
31- files_metadata = handle_download_error ( 'TSA Letter Error on download validation' ) do
31+ files_metadata = request_data_with_error_handling ( 'TSA Letter Error on download validation' ) do
3232 fetch_letter_metadata
3333 end
3434
@@ -40,7 +40,7 @@ def download
4040 end
4141
4242 download_service = ClaimsEvidenceApi ::Service ::Files . new
43- letter_response = handle_download_error ( 'TSA Letter Download Error' ) do
43+ letter_response = request_data_with_error_handling ( 'TSA Letter Download Error' ) do
4444 download_service . download ( params [ :id ] , params [ :version_id ] )
4545 end
4646 send_data (
@@ -97,17 +97,19 @@ def handle_show_error(error)
9797 end
9898 end
9999
100- def handle_download_error ( description , &command )
101- yield ( command )
100+ def request_data_with_error_handling ( description , &data_request )
101+ yield data_request
102102 rescue Common ::Client ::Errors ::ClientError => e
103103 status = e . respond_to? ( :status ) && e . status
104104 case status
105105 when *ERROR_MAP . keys
106- Rails . logger . info ( description ,
107- error_status : status ,
108- user_account_id : current_user . user_account_uuid )
106+ detail = {
107+ description :,
108+ error_status : status ,
109+ user_account_id : current_user . user_account_uuid ,
110+ }
109111 error_class = ERROR_MAP [ status ]
110- raise error_class
112+ raise error_class , detail :
111113 else
112114 raise e
113115 end
You can’t perform that action at this time.
0 commit comments