code: function toError(msg, cause) {
    var err = new Error(msg);
    err.cause = cause;
    return err;
  }
docs: Create an error.
  
  @param msg {String} Error message.
  @param cause {Error} The cause of the error. It is available as `cause`
  field on the outer error.