What is probably the best way to handle all kinds of errors in a nodejs application with express. If possible best way to create a custom error middleware to handle all errors that may arise in your nodejs code
What do you mean by “handle”? I think it is logical to have some middleware that catches any uncaught errors and logs them out. I think even better is to (also) catch and handle them in your code. You may have something specific you want done in certain cases, where you can either handle them, or throw an error (that maybe gets caught by your middleware) that identifies the problem, possibly with relevant data.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.