Skip to content

Commit 1e410e7

Browse files
committed
- Added better error handeling in axios client
1 parent 133bd31 commit 1e410e7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-typescript-codegen",
3-
"version": "0.12.2",
3+
"version": "0.12.3",
44
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
55
"author": "Ferdi Koomen",
66
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",

src/templates/core/axios/sendRequest.hbs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,12 @@ async function sendRequest(
1919

2020
onCancel(() => source.cancel('The user aborted a request.'));
2121

22-
return await axios.request(config);
22+
try {
23+
return await axios.request(config);
24+
} catch (error) {
25+
if (error.response) {
26+
return error.response;
27+
}
28+
throw error;
29+
}
2330
}

0 commit comments

Comments
 (0)