Expose `RequestError` to scripts
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
- Ambito
- api, developer-experience
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di actions/github-script
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
actions/github-script#728 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
actions/github-script#727 · 1 reazione ·
-
{ Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
actions/github-script#724 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
actions/github-script#723 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
actions/github-script#714 · 1 commento · 4 reazioni ·
Tutte le issue di actions/github-script
Issue simili
-
blocklist removal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pastelsky/bundlephobia#1122 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100