File tree Expand file tree Collapse file tree 1 file changed +50
-4
lines changed Expand file tree Collapse file tree 1 file changed +50
-4
lines changed Original file line number Diff line number Diff line change @@ -83,14 +83,60 @@ type FetchBaseQueryResult = Promise<
83
83
meta? : { request: Request ; response: Response }
84
84
}
85
85
| {
86
- error: {
87
- status: number
88
- data: any
89
- }
86
+ error: FetchBaseQueryError
90
87
data? : undefined
91
88
meta? : { request: Request ; response: Response }
92
89
}
93
90
>
91
+
92
+ type FetchBaseQueryError =
93
+ | {
94
+ /**
95
+ * * `number`:
96
+ * HTTP status code
97
+ */
98
+ status: number
99
+ data: unknown
100
+ }
101
+ | {
102
+ /**
103
+ * * `"FETCH_ERROR"`:
104
+ * An error that occurred during execution of `fetch` or the `fetchFn` callback option
105
+ **/
106
+ status: ' FETCH_ERROR'
107
+ data? : undefined
108
+ error: string
109
+ }
110
+ | {
111
+ /**
112
+ * * `"PARSING_ERROR"`:
113
+ * An error happened during parsing.
114
+ * Most likely a non-JSON-response was returned with the default `responseHandler` "JSON",
115
+ * or an error occurred while executing a custom `responseHandler`.
116
+ **/
117
+ status: ' PARSING_ERROR'
118
+ originalStatus: number
119
+ data: string
120
+ error: string
121
+ }
122
+ | {
123
+ /**
124
+ * * `"TIMEOUT_ERROR"`:
125
+ * Request timed out
126
+ **/
127
+ status: ' TIMEOUT_ERROR'
128
+ data? : undefined
129
+ error: string
130
+ }
131
+ | {
132
+ /**
133
+ * * `"CUSTOM_ERROR"`:
134
+ * A custom error type that you can return from your `queryFn` where another error might not make sense.
135
+ **/
136
+ status: ' CUSTOM_ERROR'
137
+ data? : unknown
138
+ error: string
139
+ }
94
140
` ` `
95
141
96
142
## Parameters
You can’t perform that action at this time.
0 commit comments