(errorType?: DevtoolsErrorType)
| 1922 | } |
| 1923 | |
| 1924 | const triggerError = (errorType?: DevtoolsErrorType) => { |
| 1925 | const activeQueryVal = activeQuery() |
| 1926 | if (!activeQueryVal) return |
| 1927 | sendDevToolsEvent({ |
| 1928 | type: 'TRIGGER_ERROR', |
| 1929 | queryHash: activeQueryVal.queryHash, |
| 1930 | metadata: { error: errorType?.name }, |
| 1931 | }) |
| 1932 | const error = |
| 1933 | errorType?.initializer(activeQueryVal) ?? |
| 1934 | new Error('Unknown error from devtools') |
| 1935 | |
| 1936 | const __previousQueryOptions = activeQueryVal.options |
| 1937 | |
| 1938 | activeQueryVal.setState({ |
| 1939 | data: undefined, |
| 1940 | status: 'error', |
| 1941 | error, |
| 1942 | fetchMeta: { |
| 1943 | ...activeQueryVal.state.fetchMeta, |
| 1944 | __previousQueryOptions, |
| 1945 | } as any, |
| 1946 | }) |
| 1947 | } |
| 1948 | |
| 1949 | const restoreQueryAfterLoadingOrError = () => { |
| 1950 | const activeQueryVal = activeQuery() |
no test coverage detected