Skip to content

Commit 5619d8c

Browse files
committed
Export HttpClientException
1 parent 9d8767e commit 5619d8c

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { HttpClientException } from "../";
2+
3+
describe("HttpClientException", () => {
4+
it("should export HttpClientException as a class", () => {
5+
expect(typeof HttpClientException).toBe("function");
6+
7+
const error = new HttpClientException({
8+
message: `HTTP Exception: `,
9+
statusCode: 422,
10+
errorCode: undefined,
11+
responseHeaders: undefined,
12+
responseBody: "{\"status\": 422, \"message\": \"Test error\"}",
13+
});
14+
15+
expect(error).toBeInstanceOf(HttpClientException);
16+
expect(error.statusCode).toBe(422);
17+
});
18+
});

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ export { default as Config } from "./config";
2424
export * from "./services/";
2525
export { hmacValidator } from "./utils";
2626
export { default as HttpURLConnectionClient } from "./httpClient/httpURLConnectionClient";
27+
export { default as HttpClientException } from "./httpClient/httpClientException";
2728
export * as Types from "./typings";
2829

0 commit comments

Comments
 (0)