Created
December 31, 2010 18:41
-
-
Save brentmc79/761236 to your computer and use it in GitHub Desktop.
raises_exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def raises_exception? | |
begin | |
yield | |
rescue => ex | |
Rails.logger.info("Exception occurred (#{ex.class.to_s}): #{ex.message}") | |
flash[:error] = "There was a problem completing your request. Please try again later." | |
redirect_to request.referrer | |
return true | |
end | |
return false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment