M
M
maiskiykot2020-08-20 21:34:38
Laravel
maiskiykot, 2020-08-20 21:34:38

How to customize laravel error output?

Laravel 6 throws errors all the time in different ways. Either it gives errors with a specific indication of the error, or some facade errors without decryption. Plus, it looks ugly every time. Can anyone suggest a solution for customizing errors so that everything looks nice and informative? Better package.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
maiskiykot, 2021-12-11
@maiskiykot

Here is a customization option . Especially for those who do not have time for their own options

�
 Sergey Galkin, 2020-08-21
@sive

I won’t suggest a package for displaying expats, but if you don’t have enough of what the logs give out, you can put, for example, such a package .
If you decide to write your own error handler, then you need to do it in App\Exceptions\Handler and override/add your own logic in the render method. You can see an example of the implementation of error trapping in the lara in Illuminate\Foundation\Exceptions\Handler and also in the render method.

A
Alex Wells, 2020-08-22
@Alex_Wells

What? Do you want some "package" to come up with the text of the error, based on the context of the code or what? Do you understand what you want?
If you want normal errors - well, write a handler, as you are advised, and give the user what errors you want. And in custom cases - throw an exception and output it.
What is the problem? There are no packages and there cannot be, because this is YOUR task as a programmer in a specific project with specific business logic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question