A
A
astrotrain2017-03-15 16:37:25
PHP
astrotrain, 2017-03-15 16:37:25

What is the best way to deal with mysql error?

I want to extend a small php class for my needs, and now the question arose - if there is an error, should I exit the web application (that is, extinguish everything and display an error to the user) or continue working? How and in what cases should you act? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2017-03-15
@alexey-m-ukolov

Depends on the type of error and application logic.
The main thing is not to "jam" the error at all.
If it can be processed (for example, there is no search string, but there is a default value), then you need to do this and log an exception.
If the error cannot be handled, then it is better to fall. The sooner the application crashes, the easier it will be to catch and fix the problem (ideally, all such crashes will occur at the testing and acceptance stage and these bugs will not reach the user).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question