0
I have an app web in PHP where I submit a set of invoices. This processing is done according to the due date. As some days take longer to finish than others, it may occur timeout.
For being a legacy system, I can’t increase the maximum running time any longer (set_time_limit).
When this occurs, I display the generic message of "Processing error", which does not make it clear to the user that the problem was very long execution time.
How can I control to display a message different in case of timeout?
Ideally in Javascript, would be possible?
The ideal solution would be for you to have a separate process or server that will consume these Jobs which are too slow to be processed in a single request, and after they are processed warn the user about the result. As it is a legacy system, I don’t know if such a change would be possible in your case. That answer on Soen have some examples if any help.
– fernandosavio
I guess it depends on how it’s done. Roughly speaking, PHP only serves to render the page, that is, if the processing delays the "delivery" of the page (it is processing for a long time), I think a solution via JS would be better, asynchronously, and the user does not think that the page or the site has crashed.
– Sam
Have you ever tried to capture this error with Try catch ? No JS even ? If you can capture this error, you can display a custom message to your user, since it seems to me that your problem is the user knowing what happened..
– Matheus Barbosa
@Matheusbarbosa tried yes but without success.. none of the Try catch controls caught my return.. (neither taking real time nor simulating with a comeback event)
– rLinhares