code: function error(err) {
      if (!(err instanceof Error)) return err
      return {
          code: err.code,
          message: err.message,
          details: err.detail,
          stack: err.stack || ''
      }
  }
docs: Make errors serializeable