Timeout related error message is unclear
Jhunter1 opened this issue · comments
We recently had an issue with a slow DNS lookup (10 seconds) on our Ruby on Rails web server which caused the code to timeout and fail after about 10 seconds. This error message could be made clearer I think for future users facing similar issues?
"Oops, we failed to validate your reCAPTCHA response. Please try again."
https://github.com/ambethia/recaptcha/blob/master/test/verify_test.rb
In our case the client doesn't get a 500 error - they only get the custom error message that has been added to our website's code. The error from the recaptcha Gem is "Oops, we failed to validate your reCAPTCHA response. Please try again." and we send that to a log file/Rails.logger.warn as shown below:
if verify_recaptcha(model: @user)
@user.deliver_reset_password_instructions! if @user
redirect_to(root_path, :notice => 'Instructions have been sent to your email.')
else
Rails.logger.warn("recapthca error #{@user.errors.full_messages}")
flash[:alert] = "recaptcha not verified!"
render :action => :new
end
I am not a full time dev so I will leave it up to you to decide if it is worth changing the error message and if it can be helpful for others