From 93851b8c901bb0f44f6798f9155552ba45a6e0be Mon Sep 17 00:00:00 2001 From: sboursen-scinote Date: Mon, 6 Feb 2023 13:49:34 +0100 Subject: [PATCH] Fix code style issues [SCI-7831] --- app/controllers/external_protocols_controller.rb | 8 ++++---- .../protocol_importers/import_protocol_service.rb | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/external_protocols_controller.rb b/app/controllers/external_protocols_controller.rb index 38553a0ce..7551c7989 100644 --- a/app/controllers/external_protocols_controller.rb +++ b/app/controllers/external_protocols_controller.rb @@ -19,7 +19,7 @@ class ExternalProtocolsController < ApplicationController page_id: service_call.protocols_list[:pagination][:current_page] } else - render json: { errors: service_call.errors }, status: 400 + render json: { errors: service_call.errors }, status: :bad_request end end @@ -43,7 +43,7 @@ class ExternalProtocolsController < ApplicationController rescue StandardError => e render json: { errors: [protocol_html_preview: e.message] - }, status: 400 + }, status: :bad_request end # GET build_online_sources_protocol @@ -74,7 +74,7 @@ class ExternalProtocolsController < ApplicationController validation_errors: { protocol: @protocol.errors.messages } } else - render json: { errors: service_call.errors }, status: 400 + render json: { errors: service_call.errors }, status: :bad_request end end @@ -95,7 +95,7 @@ class ExternalProtocolsController < ApplicationController render json: { protocol: service_call.protocol, message: message } else - render json: { validation_errors: service_call.errors }, status: 400 + render json: { validation_errors: service_call.errors }, status: :bad_request end end diff --git a/app/services/protocol_importers/import_protocol_service.rb b/app/services/protocol_importers/import_protocol_service.rb index 4f4163da0..e974dffd3 100644 --- a/app/services/protocol_importers/import_protocol_service.rb +++ b/app/services/protocol_importers/import_protocol_service.rb @@ -56,9 +56,9 @@ module ProtocolImporters private - def format_error(e) - error_type, *error_message = e.message.split(': ')[1].split(' ') - {error_type.downcase.to_sym => [error_message.join(' ')]} + def format_error(err) + error_type, *error_message = err.message.split(': ')[1].split(' ') + { error_type.downcase.to_sym => [error_message.join(' ')] } end def valid?