code: function handleError(state, message, ex) {
    logError(message + ' (In: ' + state.stack.join(' > ') + ')');
    if (ex) {
      logError(ex);
    }
  }
docs: A generic way of reporting errors, for easy overloading in different
  environments.
  @param message the error message to report.
  @param ex optional associated exception.