From b2f7806a98dfe62694895969adeb0493bb870378 Mon Sep 17 00:00:00 2001 From: Ryan Lyu Date: Mon, 5 Sep 2022 13:56:49 +0800 Subject: [PATCH] exception.message should return a string. ## Problem Sentry is a popular exception monitoring tool for ruby, but it fails to capture the error raised by checkr ruby gem. After some investigation, I found the checkr sometime set an array to the exception message. Here is an example ``` exception.message => ["First name must only contain letters, numbers, spaces, hyphens, apostrophes, periods, and commas."] ``` Usually, ruby exception's `message` method should return a string as an abstraction of error and developer save the detail information to internal instance variable. ## Solution This PR is to convert the message variable to a string to avoid crashing the monitoring tool. --- lib/checkr/errors/checkr_error.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkr/errors/checkr_error.rb b/lib/checkr/errors/checkr_error.rb index 79250a1..5208716 100644 --- a/lib/checkr/errors/checkr_error.rb +++ b/lib/checkr/errors/checkr_error.rb @@ -6,7 +6,7 @@ class CheckrError < StandardError attr_reader :json_body def initialize(message=nil, http_status=nil, http_body=nil, json_body=nil) - @message = message + @message = message.to_s @http_status = http_status @http_body = http_body @json_body = json_body