(errorType?: DevtoolsErrorType)
| 2049 | } |
| 2050 | |
| 2051 | const triggerError = (errorType?: DevtoolsErrorType) => { |
| 2052 | const activeQueryVal = activeQuery() |
| 2053 | if (!activeQueryVal) return |
| 2054 | sendDevToolsEvent({ |
| 2055 | type: 'TRIGGER_ERROR', |
| 2056 | queryHash: activeQueryVal.queryHash, |
| 2057 | metadata: { error: errorType?.name }, |
| 2058 | }) |
| 2059 | const error = |
| 2060 | errorType?.initializer(activeQueryVal) ?? |
| 2061 | new Error('Unknown error from devtools') |
| 2062 | |
| 2063 | const __previousQueryOptions = activeQueryVal.options |
| 2064 | |
| 2065 | activeQueryVal.setState({ |
| 2066 | data: undefined, |
| 2067 | status: 'error', |
| 2068 | error, |
| 2069 | fetchMeta: { |
| 2070 | ...activeQueryVal.state.fetchMeta, |
| 2071 | __previousQueryOptions, |
| 2072 | } as any, |
| 2073 | }) |
| 2074 | } |
| 2075 | |
| 2076 | const restoreQueryAfterLoadingOrError = () => { |
| 2077 | const activeQueryVal = activeQuery() |
no test coverage detected