mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
- Added error handler for XHR when resource is unreachable
This commit is contained in:
parent
d482a5716d
commit
133bd31473
@ -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",
|
||||
|
||||
@ -17,6 +17,7 @@ async function sendRequest(
|
||||
return new Promise<XMLHttpRequest>((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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user