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 d0fbd4d commit e4050f5Copy full SHA for e4050f5
‎packages/cli/src/codegen/openapi/generator.ts‎
@@ -85,12 +85,15 @@ export class OpenapiRequestGenerator {
85
86
static getSchemaFromUrl = async ({ url, config }: { url: string; config: Config }) => {
87
if (isUrl(url)) {
88
- const client = createClient({ url });
+ const client = createClient<{ error: { code?: string; message: string } }>({ url });
89
const getSchema = client.createRequest<{ response: Document }>()({ endpoint: "" });
90
const { data, error } = await getSchema.send();
91
if (data) {
92
return data;
93
}
94
+ if (error?.code === "ECONNREFUSED") {
95
+ throw new Error(`Cannot reach the server: ${url}`);
96
+ }
97
throw error || new Error("Failed to fetch schema");
98
99
0 commit comments