new generated Fetcher: Expected an error object to be thrown
el-j opened this issue · comments
I ran into this problem all the time i regenerate the fetcher.ts file from scratch:
in the template it is:
throw {
status: "unknown" as const,
payload:
e instanceof Error ? `Network error (${e.message})` : "Network error",
};
my fix, but i am not sure if it works for everyone.
let errorObject: Error = {
name: "unknown" as const,
message:
e instanceof Error ? `Network error (${e.message})` : "Network error",
stack: e as string,
};
throw errorObject;
the line of code from the template is here:
https://github.com/fabien0102/openapi-codegen/blob/main/plugins/typescript/src/templates/fetcher.ts#L123