MCPcopy
hub / github.com/slackapi/node-slack-sdk / httpErrorFromResponse

Function httpErrorFromResponse

packages/web-api/src/errors.ts:76–86  ·  view source on GitHub ↗
(response: AxiosResponse)

Source from the content-addressed store, hash-verified

74 * @param response - original error
75 */
76export function httpErrorFromResponse(response: AxiosResponse): WebAPIHTTPError {
77 const error = errorWithCode(
78 new Error(`An HTTP protocol error occurred: statusCode = ${response.status}`),
79 ErrorCode.HTTPError,
80 ) as Partial<WebAPIHTTPError>;
81 error.statusCode = response.status;
82 error.statusMessage = response.statusText;
83 error.headers = response.headers;
84 error.body = response.data;
85 return (error as WebAPIHTTPError);
86}
87
88/**
89 * A factory to create WebAPIPlatformError objects

Callers 1

taskMethod · 0.90

Calls 1

errorWithCodeFunction · 0.70

Tested by

no test coverage detected