JavaScript Debugging Tips Part IV – Error Handling
esri.com