We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 781cf92 commit ff57082Copy full SHA for ff57082
docs/openapi-fetch/middleware-auth.md
@@ -64,8 +64,9 @@ Middleware can also be used to throw an error that `fetch()` wouldn’t normally
64
65
```ts
66
onResponse({ response }) {
67
- if (response.error) {
68
- throw new Error(response.error.message);
+ if (!response.ok) {
+ // Will produce error messages like "https://example.org/api/v1/example: 404 Not Found".
69
+ throw new Error(`${response.url}: ${response.status} ${response.statusText}`)
70
}
71
72
```
0 commit comments