Skip to content

Commit f3c395c

Browse files
committed
fix: correct onError middleware syntax in docs
Fixes #2517 Removed nested onError function that caused TypeScript error. The correct syntax is to directly return an Error instance from the onError method, not nest another onError function inside it.
1 parent 12f9c29 commit f3c395c

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

docs/openapi-fetch/api.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ const myMiddleware: Middleware = {
242242
},
243243
async onError({ error }) {
244244
// wrap errors thrown by fetch
245-
onError({ error }) {
246-
return new Error("Oops, fetch failed", { cause: error });
247-
},
245+
return new Error("Oops, fetch failed", { cause: error });
248246
},
249247
};
250248

docs/openapi-fetch/middleware-auth.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ const myMiddleware: Middleware = {
2929
},
3030
async onError({ error }) {
3131
// wrap errors thrown by fetch
32-
onError({ error }) {
33-
return new Error("Oops, fetch failed", { cause: error });
34-
},
32+
return new Error("Oops, fetch failed", { cause: error });
3533
},
3634
};
3735

0 commit comments

Comments
 (0)