- Added better error handeling in axios client

This commit is contained in:
Ferdi Koomen 2021-11-18 22:35:08 +01:00
parent 133bd31473
commit 1e410e75ea
2 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "openapi-typescript-codegen",
"version": "0.12.2",
"version": "0.12.3",
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
"author": "Ferdi Koomen",
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",

View File

@ -19,5 +19,12 @@ async function sendRequest(
onCancel(() => source.cancel('The user aborted a request.'));
return await axios.request(config);
try {
return await axios.request(config);
} catch (error) {
if (error.response) {
return error.response;
}
throw error;
}
}