-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helper functions not available in rescue_from #438
Comments
I was able to get around this by defining a constant. It's a bit ugly but it works...something like this: module API
LOGGER = Logger.new(...)
logger LOGGER
rescue_from :all do |e|
LOGGER.error e
end
end |
I think you should leave it open. I think |
none of the helpers are available in rescue_from either, no? On Wed, Jul 17, 2013 at 8:45 AM, Ismael Abreu notifications@github.comwrote:
|
correct, no helpers are available there. I think it's a bit strange. |
+1 Fixing this would be GREAT. |
+1 |
+1, the |
+1 I just ran into this issue as well, trying to access |
+1 |
You can access helpers, etc from a
|
@cmaitchison that tip was super helpful thanks! |
Thanks for the workaround. This is a huge pain. Please fix! |
Would be great to fix this, also the workaround does not work for me:
Gives: ArgumentError: uncaught throw :error any ideas? thanks! |
I'm using it like this https://github.com/aserafin/grape_logging#logging-exceptions. You can also checkout the gem itself - it provides you with basic similar to Rails logging features. |
@cmaitchison life saver. |
+1, logger is essential in the whole code, especially in rescue_from. It's a pity it wasn't solved yet after more than 2 years :( |
@flocsy Make a PR? |
Just for the record, Other/custom helpers however still aren't. |
This was fixed on HEAD, thanks @namusyaka. |
Hi, we are trapping errors in rescue_from but unable to log them because the logger variable appears out of scope. Any ideas on how to access it? Thanks.
The text was updated successfully, but these errors were encountered: