code: function normalizeError(err) {
    let message = 'Unknown error';
  
    if (err) {
      if (err instanceof Error) {
        return err;
      }
  
      message = err.stack || err.message || err;
    }
  
    return new Error(message);
  }
docs: Ensures an error inherits from Error