(errorType?: DevtoolsErrorType)
| 1664 | } |
| 1665 | |
| 1666 | const triggerError = (errorType?: DevtoolsErrorType) => { |
| 1667 | const activeQueryVal = activeQuery() |
| 1668 | if (!activeQueryVal) return |
| 1669 | sendDevToolsEvent({ |
| 1670 | type: 'TRIGGER_ERROR', |
| 1671 | queryHash: activeQueryVal.queryHash, |
| 1672 | metadata: { error: errorType?.name }, |
| 1673 | }) |
| 1674 | const error = |
| 1675 | errorType?.initializer(activeQueryVal) ?? |
| 1676 | new Error('Unknown error from devtools') |
| 1677 | |
| 1678 | const __previousQueryOptions = activeQueryVal.options |
| 1679 | |
| 1680 | activeQueryVal.setState({ |
| 1681 | data: undefined, |
| 1682 | status: 'error', |
| 1683 | error, |
| 1684 | fetchMeta: { |
| 1685 | ...activeQueryVal.state.fetchMeta, |
| 1686 | __previousQueryOptions, |
| 1687 | } as any, |
| 1688 | }) |
| 1689 | } |
| 1690 | |
| 1691 | const restoreQueryAfterLoadingOrError = () => { |
| 1692 | const activeQueryVal = activeQuery() |
no test coverage detected