-2

How do I catch this exception?

    begin
      data = Base64.strict_decode64(data) # decode data
      ...
    rescue ArgumentError => e
      logger.severe "Could not decrypt data: #{e}, #{data}"

Log

ArgumentError (invalid base64): config/application.rb:32:in `decrypt'

Chloe
  • 25,162
  • 40
  • 190
  • 357
  • 2
    you are already catching the exception, you might need to be more explicit with your question – bjhaid Jan 26 '14 at 00:25

1 Answers1

2

I realized that I modified config/application, which requires restarting the server. Which is odd, because the error page showed the updated source code and the line number pointing to begin!

I found I did not have access to logger either! This is the finished product:

    begin
      data = Base64.strict_decode64(data) # decode data
      ...
    rescue ArgumentError => e
      Rails.logger.warn "Could not decrypt data: #{e}, #{data}"
      text = ""
    end
Chloe
  • 25,162
  • 40
  • 190
  • 357