Talk given on 10/8/08

  1. Assume code will fail
  2. Log errors back to server
    • sample code:
      function log(sev, msg) { var img = new Image(); img.src = 'log.php?sev=' + encodeURIComponent(sev) + '&msg=' + encodeURIComponent(msg); }//example usage
      try {
      //fn()
      catch (e) {
      log(2, ‘fn() failed: ’ + e.message());
      }
    • Log front-end errors to same place as back-end errors
  3. Define error handling
    • Use try-catch
    • Catch block stops exception ‘bubbling’ (my phrasing)
  4. Identify error points
  5. Throw errors
  6. Fatal vs. non-fatal
  7. Define debug mode