Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Expose `RequestError` to scripts

Aperta
#682 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
github, javascript, typescript

Direzione di ricerca

Use the README's Request Error Handling example as the behavioral reference; trace the script-facing API and its public exports to find where RequestError can be made available. Done means scripts can import RequestError and use instanceof for Octokit errors while preserving handling of unrelated errors.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is your feature request related to a problem? Please describe.

https://github.com/octokit/octokit.js?tab=readme-ov-file#request-error-handling

import { RequestError } from "octokit";

try {
  // your code here that sends at least one Octokit request
  await octokit.request("GET /");
} catch (error) {
  // Octokit errors are instances of RequestError, so they always have an `error.status` property containing the HTTP response code.
  if (error instanceof RequestError) {
    // handle Octokit error
    // error.message; // Oops
    // error.status; // 500
    // error.request; // { method, url, headers, body }
    // error.response; // { url, status, headers, data }
  } else {
    // handle all other errors
    throw error;
  }
}

Scripts don't have access to the RequestError class, making error handling a pain.

Describe the solution you'd like
Expose RequestError to the script.

Describe alternatives you've considered
You can skip the instanceof check and access the attribute directly (e.g. error.status) but this is approach is very imprecise and error-prone.

Lingua principale
TypeScript
Stelle
5k
Fork
586
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di actions/github-script

Tutte le issue di actions/github-script

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.