mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-14 00:54:32 +08:00
Log to console when error occur on ProtocolsImport actions
This commit is contained in:
parent
1a75a31647
commit
cc3cd43270
3 changed files with 8 additions and 3 deletions
|
@ -10,7 +10,7 @@ module ProtocolImporters
|
|||
@user = User.find_by_id user_id
|
||||
@team = Team.find_by_id team_id
|
||||
@protocol_params = protocol_params
|
||||
@steps_params = JSON.parse(steps_params_json) # catch error here
|
||||
@steps_params = JSON.parse(steps_params_json)
|
||||
@errors = {}
|
||||
end
|
||||
|
||||
|
@ -26,7 +26,7 @@ module ProtocolImporters
|
|||
.slice(:name, :position, :description, :tables_attributes)
|
||||
.merge(user: @user, completed: false))
|
||||
|
||||
# 'Manually' create assets here. "Accept nasted attributes won't work assets"
|
||||
# 'Manually' create assets here. "Accept nasted attributes" won't work for assets
|
||||
s.assets << AttachmentsBuilder.generate(step_params.deep_symbolize_keys, user: @user, team: @team)
|
||||
s
|
||||
end
|
||||
|
|
|
@ -80,7 +80,10 @@ module ProtocolImporters
|
|||
def with_handle_network_errors
|
||||
yield
|
||||
rescue StandardError => e
|
||||
raise ProtocolImporters::ProtocolsIO::V3::NetworkError.new(e.class), e.message
|
||||
Rails.logger.error "Error: #{e.class}, message: #{e.message}"
|
||||
|
||||
raise ProtocolImporters::ProtocolsIO::V3::NetworkError.new(e.class),
|
||||
I18n.t('protocol_importers.errors.cannot_import_protocol')
|
||||
end
|
||||
|
||||
def check_for_response_errors(response)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
en:
|
||||
protocol_importers:
|
||||
errors:
|
||||
cannot_import_protocol: "We weren't able to import the protocol because something went wrong"
|
||||
new:
|
||||
modal_title: 'Import protocol - %{protocol_name}'
|
||||
card:
|
||||
|
|
Loading…
Add table
Reference in a new issue