0

Irrespective of any business logic, what errors must be handled in node server. ?

What are potential errors/exceptions ?

I have tried to take care of following things-

  1. uncaughtException
  2. socket error event
  3. EMFILE, open

Also having only one logger for complete application.

Need to handle common potential errors before it goes to production server.

Also, links would be helpful.

Pranav
  • 2,054
  • 4
  • 27
  • 34
  • It's kind of scary if you're asking this question just before launching to production....put in some proper unit tests and get some good code coverage. The errors will present themselves if you do this right. – mpen Oct 25 '13 at 06:49
  • no no, not immediately on production server but after month. I have time to test it well but just to know errors like EMFILE,open which was caught during testing. Just want to take care that common errors are not handled. Also I am using forever for execution. – Pranav Oct 25 '13 at 07:09

1 Answers1

0

The right answer of your question is: you should take care about any type of errors. Your code should be error-free. Using try-catch statements or with just simple if checks you have to cover all the possible mistakes.

Krasimir
  • 13,306
  • 3
  • 40
  • 55
  • Yeah, the code is in try catch blocks, handled errors, but I want to improve any runtime error handling. – Pranav Oct 25 '13 at 07:10
  • And as you said I want to make it error free :) have gone through node docs also. Need some kind of confirmation from people like you. – Pranav Oct 25 '13 at 07:11
  • I think that making your code error free is not related to nodejs in particular. We all are trying to do this in every other language. Nodejs doesn't have instruments/tools for solving runtime errors that. That's a job of the developer. – Krasimir Oct 25 '13 at 07:24
  • yeah, that is understood, I am not looking for any tool, I wanted to know any common known issues before hand. Handling "UncaughtException" is best example of knowing what may go wrong. I was searching for similar things...thanx. – Pranav Oct 25 '13 at 07:55