Skip to content

Commit 133bd31

Browse files
committed
- Added error handler for XHR when resource is unreachable
1 parent d482a57 commit 133bd31

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
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.1",
3+
"version": "0.12.2",
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/xhr/sendRequest.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ async function sendRequest(
1717
return new Promise<XMLHttpRequest>((resolve, reject) => {
1818
xhr.onload = () => resolve(xhr);
1919
xhr.onabort = () => reject(new Error('The user aborted a request.'));
20+
xhr.onerror = () => reject(new Error('Network error.'));
2021
xhr.send(body || formData);
2122

2223
onCancel(() => xhr.abort());

0 commit comments

Comments
 (0)