We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f14b57b commit f89bd76Copy full SHA for f89bd76
packages/openapi-ts/src/getSpec.ts
@@ -109,14 +109,21 @@ export const getSpec = async ({
109
}
110
111
112
- const fileRequest = await sendRequest({
113
- init: {
114
- method: 'GET',
115
- },
116
- timeout,
117
- url: resolvedInput.path,
118
- });
119
- response = fileRequest.response;
+ try {
+ const fileRequest = await sendRequest({
+ init: {
+ method: 'GET',
+ },
+ timeout,
+ url: resolvedInput.path,
+ });
120
+ response = fileRequest.response;
121
+ } catch (ex) {
122
+ return {
123
+ error: 'not-ok',
124
+ response: new Response(ex.message),
125
+ };
126
+ }
127
128
if (!response.ok) {
129
// assume the server is no longer running
0 commit comments