exception_handler icon indicating copy to clipboard operation
exception_handler copied to clipboard

Add Failing URL to the email

Open IsmailM opened this issue 5 years ago • 8 comments

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...

IsmailM avatar Feb 07 '19 21:02 IsmailM

Same doubt...

PedroPauloML avatar Feb 18 '19 02:02 PedroPauloML

Thanks guys, let me have a look at this - I am sure the URL exists in the class that's created

richpeck avatar Feb 18 '19 07:02 richpeck

The URL exists within the @exception object. I can amend the email template if required, or you can call @exception.target

richpeck avatar Feb 18 '19 08:02 richpeck

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 avatar Feb 18 '19 14:02 IsmailM

@IsmailM, try @exception.request.referer

iFalcao avatar May 21 '19 12:05 iFalcao

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.

terryyin avatar Oct 21 '20 07:10 terryyin

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.

JulianC606 avatar Oct 21 '20 22:10 JulianC606

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?

JulianC606 avatar Oct 21 '20 22:10 JulianC606