How to handle background exceptions in web development?

Hello, everyone. I am a novice developer of web . There is a question that puzzles me.

what should I do if an exception occurs in the background after the front end of the user submits the request?

this is what I usually do:

1. 
2. 

I think my way of dealing with it has many disadvantages:

1. 
2. 
3. 

I wonder how the great gods deal with it.

Sep.02,2021

it is feasible to return the error code to the front end uniformly.
but the actual exception is logged. Normally, the backend uses ELK to collect logs generated by the system.
developers can check log details in the logging system, and send email or SMS alerts if there are serious anomalies.


the submitted form can be verified at the front end, and the fields needed by the back end are clear, and then the front end controls the input errors before submission in the front end according to the field requirements, ensuring that the data submitted in strict accordance with the requirements of the background fields when you click submit. At this point, most of the anomalies are avoided. The rest of the exceptions can allow the backend to set a unified status code. The front end prompts


the background captures the exception and returns the unified status code. You can give the user a modal box prompt according to the status code: "if there is a system exception, please contact the system administrator!" Wait, wait


there is a special BUG tracking platform, and frameworks like Laravel have a unified exit that catches abnormal base classes at the exit. The exception is then passed to the BUG platform, which automatically records the content of the error and the user requests for information.


2. No one will read the log, so even if you write the log and no one sees it
does not read the log, are you going to let the program fix bug on its own?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b1f3-2b9e6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b1f3-2b9e6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?