Skip to content

Commit

Permalink
fix webhook http error statusCode in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
aoberoi committed Aug 20, 2019
1 parent 3a0e063 commit d20d81b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/webhook/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AxiosError } from 'axios';
import { AxiosError, AxiosResponse } from 'axios';

/**
* All errors produced by this package adhere to this interface
Expand Down Expand Up @@ -54,9 +54,9 @@ export function requestErrorWithOriginal(original: AxiosError): IncomingWebhookR
* A factory to create IncomingWebhookHTTPError objects
* @param original The original error
*/
export function httpErrorWithOriginal(original: AxiosError): IncomingWebhookHTTPError {
export function httpErrorWithOriginal(original: AxiosError & { response: AxiosResponse }): IncomingWebhookHTTPError {
const error = errorWithCode(
new Error(`An HTTP protocol error occurred: statusCode = ${original.code}`),
new Error(`An HTTP protocol error occurred: statusCode = ${original.response.status}`),
ErrorCode.HTTPError,
) as Partial<IncomingWebhookHTTPError>;
error.original = original;
Expand Down

0 comments on commit d20d81b

Please sign in to comment.