Revert "fix(sentry): add Sentry.ErrorBoundary"

This reverts commit ec60b7c1bc.
pull/217/head
Andrei Dekterev 3 years ago
parent 727aaece68
commit 877747322b
  1. 35237
      package-lock.json
  2. 1
      package.json
  3. 46
      src/components/ErrorBoundary/index.tsx
  4. 2
      src/features/App/index.tsx
  5. 9
      src/helpers/callApi/logoutIfUnauthorized.tsx
  6. 15
      src/index.tsx

35237
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -23,7 +23,6 @@
},
"dependencies": {
"@reactour/tour": "^3.3.0",
"@sentry/react": "^7.53.1",
"@stripe/react-stripe-js": "^1.4.0",
"@stripe/stripe-js": "^1.13.2",
"babel-polyfill": "^6.26.0",

@ -1,8 +1,8 @@
import React from 'react'
// eslint-disable react/destructuring-assignment
import type{ ReactNode } from 'react'
import { Component } from 'react'
import * as Sentry from '@sentry/react'
import type{ ErrorInfo, ReactNode } from 'react'
import { Error } from '../Error'
@ -10,15 +10,41 @@ interface Props {
children?: ReactNode,
}
export const ErrorBoundary = ({ children }: Props) => (
<Sentry.ErrorBoundary fallback={(
interface State {
hasError: boolean,
}
class ErrorBoundary extends Component<Props, State> {
// eslint-disable-next-line react/state-in-constructor
public state: State = {
hasError: false,
}
public static getDerivedStateFromError(_: Error): State {
// Update state so the next render will show the fallback UI.
return { hasError: true }
}
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
// eslint-disable-next-line no-console
console.error(
'Uncaught error:',
error,
errorInfo,
)
}
public render() {
const { hasError } = this.state
const { children } = this.props
return (
<>
{hasError && <Error />}
{children}
<Error />
</>
)}
>
{ children }
</Sentry.ErrorBoundary>
)
}
}
export default ErrorBoundary

@ -23,7 +23,7 @@ import { GlobalStyles } from 'features/GlobalStyles'
import { Theme } from 'features/Theme'
import { UnavailableText } from 'components/UnavailableText'
import { ErrorBoundary } from 'components/ErrorBoundary'
import ErrorBoundary from 'components/ErrorBoundary'
import { AuthenticatedApp } from './AuthenticatedApp'
import { useAuthStore } from '../AuthStore'

@ -1,13 +1,5 @@
import * as Sentry from '@sentry/react'
export const logoutIfUnauthorized = async (response: Response) => {
/* отключили из-за доступа без авторизации */
const body = await response.json()
if (response.status === 400) {
Sentry.captureException(body)
}
if (response.status === 401 || response.status === 403) {
window.dispatchEvent(new Event('FORBIDDEN_REQUEST'))
}
@ -16,5 +8,6 @@ export const logoutIfUnauthorized = async (response: Response) => {
// eslint-disable-next-line no-console
console.error(error)
const body = await response.json()
return Promise.reject(body)
}

@ -5,24 +5,11 @@ import {
} from 'react'
import ReactDOM from 'react-dom'
import * as Sentry from '@sentry/react'
import { BrowserTracing } from '@sentry/react'
import { isIOS, ENV } from 'config'
import { isIOS } from 'config/userAgent'
// import { makeServer } from 'utilits/mirage/Mirage'
import * as serviceWorker from './serviceWorker'
if (process.env.NODE_ENV !== 'development') {
Sentry.init({
dsn: 'https://bbe0cdfb954644ebaf3be16bb472cc3d@sentry.insports.tv/21',
environment: ENV,
integrations: [new BrowserTracing()],
tracesSampleRate: 1.0,
})
}
export const App = process.env.REACT_APP_TYPE === 'auth-service'
? lazy(() => import('features/AuthServiceApp'))
: lazy(() => import('features/App'))

Loading…
Cancel
Save