Open brianRingler opened 11 months ago
We should look at a logger library. I haven't had time to read this all, but a good place to start: https://hackernoon.com/the-10-best-nodejs-logging-libraries . I'll follow up when I get a chance to research more
I made some minor changes and pushed them to the main page.
app/api/auth/register-user
The first change was to wrap the checking if the user email already exists in the database. It was not wrapped in a catch block.
So, now both queries to the database are wrapped. To test, you can modify the query to be user_profiless with an extra s which will force an error. Both times the custom error page was pulled up with the option to click and return to home page.
app/error-page/page.jsx
. Note, I did have to fix the page name as it had a typo.Couple thoughts:
1) How do we want to handle errors to the database? Right now, the code just has a console log and the user gets directed to an error page. However, if there is a problem and it keeps happening how are "we" being notified and fixing this issue? This really should not be an issue unless the database is down then we have a biigger issue?
2) What is the best way to log errors? Instead of creating just doing a console log to the terminal should be be logging all the errors to a text file? What is the best practice to manage this when we are in production with trillions of users using our application. I think we should create a defined strategy for how to properly handle and log each error. Logging to the console is not good enough as it does not resolve the problem.