@octokit-next/request-error
TypeScript icon, indicating that this package has built-in type declarations

2.8.0 • Public • Published

request-error.js

Error class for Octokit request errors

@latest Build Status

Usage

Browsers Load @octokit-next/request-error directly from cdn.skypack.dev
<script type="module">
import { RequestError } from "https://cdn.skypack.dev/@octokit-next/request-error";
</script>
Node

Install with npm install @octokit-next/request-error

import { RequestError } from "@octokit-next/request-error";
const error = new RequestError("Oops", 500, {
  request: {
    method: "POST",
    url: "https://api.github.com/foo",
    body: {
      bar: "baz",
    },
    headers: {
      authorization: "token secret123",
    },
  },
  response: {
    status: 500,
    url: "https://api.github.com/foo"
    headers: {
      "x-github-request-id": "1:2:3:4",
    },
    data: {
      foo: "bar"
    }
  },
});

error.message; // Oops
error.status; // 500
error.request; // { method, url, headers, body }
error.response; // { url, status, headers, data }

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i @octokit-next/request-error

Weekly Downloads

26

Version

2.8.0

License

MIT

Unpacked Size

8.93 kB

Total Files

6

Last publish

Collaborators

  • octokit-next-bot
  • gr2m