Skip to content

Commit

Permalink
Merge pull request #131 from reflexer-labs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mstfash authored Mar 14, 2021
2 parents 438fa1e + 9b589f5 commit db7edc2
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
36 changes: 21 additions & 15 deletions src/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ class ErrorBoundary extends React.Component<Props, State> {
error,
errorInfo,
})
Sentry.withScope((scope) => {
scope.setExtras(errorInfo)
const eventId = Sentry.captureException(error)
this.setState({
eventId,

if (process.env.REACT_APP_SENTRY_KEY) {
Sentry.withScope((scope) => {
scope.setExtras(errorInfo)
const eventId = Sentry.captureException(error)
this.setState({
eventId,
})
})
})
}
}

render() {
Expand All @@ -39,15 +42,18 @@ class ErrorBoundary extends React.Component<Props, State> {
<img src={require('./assets/error.svg')} alt="" />
<h2>Something went wrong.</h2>
<br />
<Button
onClick={() =>
Sentry.showReportDialog({
eventId: this.state.eventId,
})
}
>
Report Feedback
</Button>
{process.env.REACT_APP_SENTRY_KEY ? (
<Button
onClick={() =>
Sentry.showReportDialog({
eventId: this.state.eventId,
})
}
>
Report Feedback
</Button>
) : null}

<Details>
{this.state.error && this.state.error.toString()}
<br />
Expand Down
1 change: 1 addition & 0 deletions src/components/WalletModal/Option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function Option({
}) {
const content = (
<OptionCardClickable
//@ts-ignore
id={id}
onClick={onClick}
clickable={clickable && !active}
Expand Down
5 changes: 5 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Integrations } from '@sentry/tracing'
import { NetworkContextName } from './utils/constants'
import getLibrary from './utils/getLibrary'
import { HelmetProvider } from 'react-helmet-async'
import { handlePickedEvents } from './utils/helper'

const Web3ProviderNetwork = createWeb3ReactRoot(NetworkContextName)

Expand All @@ -18,6 +19,10 @@ if (process.env.REACT_APP_SENTRY_KEY) {
dsn: process.env.REACT_APP_SENTRY_KEY,
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0,
beforeSend(event) {
const val = handlePickedEvents(event)
return val
},
})
}

Expand Down
14 changes: 14 additions & 0 deletions src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ITransaction,
} from './interfaces'
import { injected, NETWORK_ID } from '../connectors'
import Sentry from '@sentry/react'

export const returnWalletAddress = (walletAddress: string) =>
`${walletAddress.slice(0, 4 + 2)}...${walletAddress.slice(-4)}`
Expand Down Expand Up @@ -504,3 +505,16 @@ export const returnTimeOffset = () => {
const res = -Math.round(a / 60)
return res < 0 ? res : '+' + res
}

export const handlePickedEvents = (event: Sentry.Event) => {
if (!event) return null
const { exception } = event
if (exception && exception.values) {
for (let val of exception.values) {
if (val.value && val.value.toLowerCase().includes('bignumber')) {
return event
}
}
}
return null
}

0 comments on commit db7edc2

Please sign in to comment.