Skip to content

Commit

Permalink
fix: export RequestError, not HttpError
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed May 16, 2019
1 parent cd61dd7 commit 750497e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Deprecation } from "deprecation";
import once from "once";
const logOnce = once((deprecation: any) => console.warn(deprecation));

import { RequestOptions, ResponseHeaders, HttpErrorOptions } from "./types";
import { RequestOptions, ResponseHeaders, RequestErrorOptions } from "./types";

/**
* Error with extra properties to help with debugging
*/
export class HttpError extends Error {
export class RequestError extends Error {
name: "HttpError";

/**
Expand All @@ -32,7 +32,11 @@ export class HttpError extends Error {
*/
request: RequestOptions;

constructor(message: string, statusCode: number, options: HttpErrorOptions) {
constructor(
message: string,
statusCode: number,
options: RequestErrorOptions
) {
super(message);

// Maintains proper stack trace (only available on V8)
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type RequestOptions = {
request?: EndpointRequestOptions;
};

export type HttpErrorOptions = {
export type RequestErrorOptions = {
headers: ResponseHeaders;
request: RequestOptions;
};

0 comments on commit 750497e

Please sign in to comment.