async function nullIf40x()

in src/desktop/remotefs/gitlab_remote_file_system.ts [28:43]


async function nullIf40x<T>(p: Promise<T>) {
  try {
    return await p;
  } catch (e) {
    if (e instanceof FetchError) {
      const s = e.response.status;

      // Let the handler deal with 40x responses
      if (s === 401 || s === 403 || s === 404) {
        return null;
      }
    }

    throw e;
  }
}