ALWAYS USE ERROR OBJECTS
• Not simply strings
• Errors contains stack
traces
• Will provide debug value
Slide 6
Slide 6 text
CREATE CUSTOM ERRORS
• Extend Error - still of type Error
• New, specific type
• Can attach other helpful properties (eg, data
associated at time of error)
• Other standard properties in Appendix: https://us-
east.manta.joyent.com/dap/public/drop/er2.htm
ON(‘UNCAUGHTEXCEPTION’)
SHOULD ALWAYS EXIT
• Call process.exit()
• Otherwise, stuff hangs
• Long-running process
might never complete for
client; wait for timeout
• Resources can be leaked
(eg, db connections)