From 6ec2c99a2869f0f4a58bb2ebdbf8da92016bbf44 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Mon, 26 Nov 2018 13:52:01 +0100 Subject: [PATCH] Hound styling --- app/controllers/protocols_controller.rb | 6 ++---- app/helpers/protocols_io_helper.rb | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 25a950797..54a5abcda 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -656,13 +656,11 @@ class ProtocolsController < ApplicationController # where a preview modal is rendered, # and some modals get closed and opened end - rescue Exception => e + rescue StandardError => e Rails.logger.error(e.message) @protocolsio_general_error = true respond_to do |format| - format.js {} # go to the js.erb file named the same as this controller, - # where a preview modal is rendered, - # and some modals get closed and opened + format.js {} end end diff --git a/app/helpers/protocols_io_helper.rb b/app/helpers/protocols_io_helper.rb index fc2e7a5f7..60935c874 100644 --- a/app/helpers/protocols_io_helper.rb +++ b/app/helpers/protocols_io_helper.rb @@ -151,23 +151,19 @@ module ProtocolsIoHelper end def pio_eval_authors(text) - begin - # Extract authors names from the JSON - text.map { |auth| auth['name'] }.join(', ') - rescue Exception - [] - end + # Extract authors names from the JSON + text.map { |auth| auth['name'] }.join(', ') + rescue StandardError + [] end def eval_last_modified(steps) - begin - timestamps = steps.map do |step| - step['modified_on'] if step['modified_on'].present? - end - Time.at(timestamps.max).utc.to_datetime - rescue Exception - Time.at(0).utc.to_datetime + timestamps = steps.map do |step| + step['modified_on'] if step['modified_on'].present? end + Time.at(timestamps.max).utc.to_datetime + rescue StandardError + Time.at(0).utc.to_datetime end # Checks so that null values are returned as zero length strings @@ -522,5 +518,4 @@ module ProtocolsIoHelper [] end end - end