history.nette.ajax.js icon indicating copy to clipboard operation
history.nette.ajax.js copied to clipboard

How to disable markForward for ErrorPresenters?

Open enumag opened this issue 11 years ago • 6 comments

I'm using module-specific error presenters and sometimes I use forward method to send the exception from the module-specific ErrorPresenter to default one. However this triggers this line which fails to generate the link because Exception and Request are objects. I need this addon to ignore forwadding between to ErrorPresenter somehow. Not completely sure how though.

enumag avatar Aug 30 '14 21:08 enumag

Here is a draft of a new verion which is more simple and fixes this issue. What do you think about it?

https://gist.github.com/enumag/cea679af2e6349037507

(Note that I didn't test it yet. It is probably missing some use statements etc.)

enumag avatar Aug 30 '14 21:08 enumag

I've stopped using the PHP part of this extension because I don't like what it does. Closing.

enumag avatar Sep 04 '14 20:09 enumag

@enumag I think that's alright, as you can still provide correct information to JS part on your own. Have you struggled with some other issues beside this one, that led you to this decision?

vojtech-dobes avatar Sep 04 '14 20:09 vojtech-dobes

@vojtech-dobes The main reason is that I don't like your hacking of Application where you put new HttpRequest inside it. Since HttpRequest is a service, other services that are using it may not work correctly because they would still have the old HttpRequest. Also the else branch is basically making redirect out of forward method which I don't like either. When I want to change URL I use redirect, when I don't I use forward.

enumag avatar Sep 05 '14 08:09 enumag

@vojtech-dobes I had to dig into this issue a little bit more but I still don't understand the reason why the redirect property is added to payload when a forward happens. The JS part changes the URL but why do that? I mean normal forward (without ajax) doesn't change the URL.

I've some suggestions but I need to know the reasoning behind this first.

enumag avatar Jan 29 '15 18:01 enumag

@vojtech-dobes Also I think trying to replace the HttpRequest on redirect is useless. Do you have a reason to do that? We can just use Application::processRequest().

enumag avatar Jan 29 '15 18:01 enumag