P
P
photosho2016-02-07 18:22:32
Laravel
photosho, 2016-02-07 18:22:32

How to catch Token mismatch exception?

Hello. The question is this: AJAX requests are implemented on the site, in response to each of which the server first checks the user who made the request. The very first check is whether there is any authorization at all or the request was made from an unauthorized user. It seems to work, but if you sit under your nickname for a while, doing nothing (for example, go somewhere) - and when you try to send an AJAX request, an error starts to appear: "Token mismatch exception", which is not caught by the standard if (!$user)....
How can you catch this exception, for example, to display a warning to the user?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2016-02-07
@photosho

Any exception can be caught with try/catch

D
Dmitry, 2016-02-09
@DP-Studio

angrydeer.ru/laravel/laravel-5-oshibka-500-pri-aja...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question