Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kevcenteno committed Dec 2, 2024
1 parent e0f5400 commit 38ccc73
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/webServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,29 @@ export default class WebServiceClient {
}

if (response.status === 204) {
return Promise.resolve();
return;
}
data = await response.json();
} catch (err) {
const error = err as TypeError;
switch (error.name) {
case 'AbortError':
return Promise.reject({
throw {
code: 'NETWORK_TIMEOUT',
error: 'The request timed out',
url,
});
};
case 'SyntaxError':
return Promise.reject({
throw {
...invalidResponseBody,
url,
});
};
default:
return Promise.reject({
throw {
code: 'FETCH_ERROR',
error: `${error.name} - ${error.message}`,
url,
});
};
}
} finally {
clearTimeout(timeoutId);
Expand Down

0 comments on commit 38ccc73

Please sign in to comment.