diff --git a/package.json b/package.json index 0b84aa3e..1cc686e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openapi-typescript-codegen", - "version": "0.12.1", + "version": "0.12.2", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen", diff --git a/src/templates/core/xhr/sendRequest.hbs b/src/templates/core/xhr/sendRequest.hbs index 4addf125..8205edea 100644 --- a/src/templates/core/xhr/sendRequest.hbs +++ b/src/templates/core/xhr/sendRequest.hbs @@ -17,6 +17,7 @@ async function sendRequest( return new Promise((resolve, reject) => { xhr.onload = () => resolve(xhr); xhr.onabort = () => reject(new Error('The user aborted a request.')); + xhr.onerror = () => reject(new Error('Network error.')); xhr.send(body || formData); onCancel(() => xhr.abort());