Commit 06a8151e authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

Revert "add error reporting component, INTEGRATION ERROR type, and Missing...

Revert "add error reporting component, INTEGRATION ERROR type, and Missing provider error (#3107)" (#3109)

This reverts commit ac2642fe.
parent ac2642fe
...@@ -117,9 +117,7 @@ export default function ErrorDialog({ header, error, action, onAction }: ErrorDi ...@@ -117,9 +117,7 @@ export default function ErrorDialog({ header, error, action, onAction }: ErrorDi
<Rule /> <Rule />
<ErrorColumn> <ErrorColumn>
<Column gap={0.5} ref={setDetails} css={scrollbar}> <Column gap={0.5} ref={setDetails} css={scrollbar}>
<ThemedText.Code> <ThemedText.Code>{error.message}</ThemedText.Code>
{error.name}: {error.message}
</ThemedText.Code>
</Column> </Column>
</ErrorColumn> </ErrorColumn>
<ActionButton onClick={onAction}>{action}</ActionButton> <ActionButton onClick={onAction}>{action}</ActionButton>
......
import { useAtomValue } from 'jotai/utils'
import { providerAtom } from 'lib/state/web3'
import { useEffect } from 'react'
import { EMPTY } from 'widgets-web3-react/empty'
class IntegrationError extends Error {
constructor(message: string) {
super(message)
this.name = 'INTEGRATION ERROR'
}
}
const missingProviderError = new IntegrationError('Missing provider')
export default function ErrorReporter() {
const [connector] = useAtomValue(providerAtom)
useEffect(() => {
if (connector === EMPTY) {
throw missingProviderError
}
}, [connector])
return null
}
...@@ -8,7 +8,6 @@ import { Provider as EthProvider } from 'widgets-web3-react/types' ...@@ -8,7 +8,6 @@ import { Provider as EthProvider } from 'widgets-web3-react/types'
import { Provider as DialogProvider } from './Dialog' import { Provider as DialogProvider } from './Dialog'
import ErrorBoundary, { ErrorHandler } from './Error/ErrorBoundary' import ErrorBoundary, { ErrorHandler } from './Error/ErrorBoundary'
import ErrorReporter from './Error/ErrorReporter'
import Web3Provider from './Web3Provider' import Web3Provider from './Web3Provider'
const slideDown = keyframes` const slideDown = keyframes`
...@@ -101,7 +100,6 @@ export default function Widget({ ...@@ -101,7 +100,6 @@ export default function Widget({
<ErrorBoundary onError={onError}> <ErrorBoundary onError={onError}>
<AtomProvider> <AtomProvider>
<Web3Provider provider={provider} jsonRpcEndpoint={jsonRpcEndpoint}> <Web3Provider provider={provider} jsonRpcEndpoint={jsonRpcEndpoint}>
<ErrorReporter />
{children} {children}
</Web3Provider> </Web3Provider>
</AtomProvider> </AtomProvider>
......
import { WidgetProps } from 'lib/components/Widget'
import { missingProviderError } from 'lib/errors'
import { useEffect } from 'react'
export function useEnsureCorrectProps(props: WidgetProps) {
useEffect(() => {
if (!props.provider) {
throw missingProviderError
}
}, [props])
}
...@@ -3,7 +3,7 @@ import Widget, { WidgetProps } from './components/Widget' ...@@ -3,7 +3,7 @@ import Widget, { WidgetProps } from './components/Widget'
export type SwapWidgetProps = WidgetProps<typeof Swap> export type SwapWidgetProps = WidgetProps<typeof Swap>
export function SwapWidget(props: SwapWidgetProps) { export function SwapWidget({ ...props }: SwapWidgetProps) {
return ( return (
<Widget {...props}> <Widget {...props}>
<Swap {...props} /> <Swap {...props} />
......
import { createMulticall } from '@uniswap/redux-multicall' import { createMulticall } from '@uniswap/redux-multicall'
import { atom } from 'jotai'
import { atomWithStore } from 'jotai/redux' import { atomWithStore } from 'jotai/redux'
import { atomWithDefault } from 'jotai/utils' import { atomWithDefault } from 'jotai/utils'
import { createStore } from 'redux' import { createStore } from 'redux'
...@@ -13,7 +12,6 @@ export type Web3ReactState = [Connector, Web3ReactHooks] ...@@ -13,7 +12,6 @@ export type Web3ReactState = [Connector, Web3ReactHooks]
export const urlAtom = atomWithDefault<Web3ReactState>(() => EMPTY_CONNECTOR) export const urlAtom = atomWithDefault<Web3ReactState>(() => EMPTY_CONNECTOR)
export const injectedAtom = atomWithDefault<Web3ReactState>(() => EMPTY_CONNECTOR) export const injectedAtom = atomWithDefault<Web3ReactState>(() => EMPTY_CONNECTOR)
export const providerAtom = atom((get) => get(injectedAtom) || get(urlAtom))
export const multicall = createMulticall() export const multicall = createMulticall()
const multicallStore = createStore(multicall.reducer) const multicallStore = createStore(multicall.reducer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment