exception_handler
exception_handler copied to clipboard
Add Failing URL to the email
Is it possible to add the URL of where the exception happens to the Exception object?
I see @exception.target but that simply points: http://localhost:3000/500 and not the actual URL where the 500 error happened...
Same doubt...
Thanks guys, let me have a look at this - I am sure the URL exists in the class that's created
The URL exists within the @exception
object. I can amend the email template if required, or you can call @exception.target
Hi @richpeck,
Thanks for the reply.
I am currently using a custom template and did look through the source code for info on the @exception
object.
However, @exception.target
gives me the URL of the error page (e.g. /500
) and not the URL where the exception occurred.
@IsmailM, try @exception.request.referer
If you are still struggling with this, I think the "right" place to get the URL is request.env['ORIGINAL_FULLPATH']
.
I put the quote marks there is because it's probably wrong to create the Exception DB record in the controller, especially it's a show
action.
If you are still struggling with this, I think the "right" place to get the URL is
request.env['ORIGINAL_FULLPATH']
.I put the quote marks there is because it's probably wrong to create the Exception DB record in the controller, especially it's a
show
action.
Still gets /500 in case of error 500. The thing is, in my case, that if I use request.referer (or @exception.referer that points to same request object) I get the path before the error. If I use @exception.target, then it returns the error path. The thing is that is not usefull get /500, because I want to notify where the server error is thrown.
well after i search a little bit, i guess that it depends in ActionDispatcher middleware, where the request.env is created. I will guess that the middleware is dispatched when the error is already redirected to /500. So is not this gem fault of that error. But could you work on that?