Template
1
0
mirror of https://github.com/actions/setup-node synced 2024-11-30 21:22:29 +08:00
setup-node/node_modules/@octokit/request-error
2019-08-05 15:18:52 -04:00
..
dist-node new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
dist-src new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
dist-types new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
dist-web new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
LICENSE new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
package.json new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
README.md new toolkit and scoped registries 2019-08-05 15:18:52 -04:00

http-error.js

Error class for Octokit request errors

@latest Build Status Greenkeeper

Usage

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

Install with npm install @octokit/request-error

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

error.message; // Oops
error.status; // 500
error.headers; // { 'x-github-request-id': '1:2:3:4' }
error.request.method; // POST
error.request.url; // https://api.github.com/foo
error.request.body; // { bar: 'baz' }
error.request.headers; // { authorization: 'token [REDACTED]' }

LICENSE

MIT