<commit_before>import React, { StrictMode } from 'react';
import App, { Container, AppContext } from 'next/app';
import * as Sentry from '@sentry/browser';
import { ThemeProvider } from 'styled-components';
import Router from 'next/router';
// @ts-ignore
import withGA from 'next-ga';
import { NProgress } from '@mcansh/next-nprogress';
import GlobalStyle from '~/components/styles/global-style';
import { colors } from '~/config';
import Document from '~/components/layouts/document';

Sentry.init({
  dsn: process.env.SENTRY,
  release: `blog@${process.env.VERSION}_${process.env.BUILD_ID}`,
  environment: process.env.NODE_ENV,
});

interface Props {
  Component: React.Component;
  pageProps: Record<string, any>;
  locale: string;
  initialNow: number;
}

class MyApp extends App<Props> {
  public static getInitialProps = async ({ Component, ctx }: AppContext) => {
    let pageProps = {};

    if (Component.getInitialProps) {
      pageProps = await Component.getInitialProps(ctx);
    }

    return { pageProps };
  };

  public componentDidCatch(error: Error, errorInfo: any) {
    Sentry.withScope(scope => {
      Object.keys(errorInfo).forEach(key => {
        scope.setExtra(key, errorInfo[key]);
      });

      Sentry.captureException(error);
    });

    super.componentDidCatch(error, errorInfo);
  }

  public render() {
    const { Component, pageProps } = this.props;

    return (
      <StrictMode>
        <Container>
          <ThemeProvider theme={colors}>
            <>
              <NProgress
                color={colors.primary}<commit_msg>improvement: cleanup sentry componentDidCatch<commit_after>import React, { StrictMode } from 'react';
import App, { Container, AppContext } from 'next/app';
import * as Sentry from '@sentry/browser';
import { ThemeProvider } from 'styled-components';
import Router from 'next/router';
// @ts-ignore
import withGA from 'next-ga';
import { NProgress } from '@mcansh/next-nprogress';
import GlobalStyle from '~/components/styles/global-style';
import { colors } from '~/config';
import Document from '~/components/layouts/document';

Sentry.init({
  dsn: process.env.SENTRY,
  release: `blog@${process.env.VERSION}_${process.env.BUILD_ID}`,
  environment: process.env.NODE_ENV,
});

interface Props {
  Component: React.Component;
  pageProps: Record<string, any>;
  locale: string;
  initialNow: number;
}

class MyApp extends App<Props> {
  public static getInitialProps = async ({ Component, ctx }: AppContext) => {
    let pageProps = {};

    if (Component.getInitialProps) {
      pageProps = await Component.getInitialProps(ctx);
    }

    return { pageProps };
  };

  public componentDidCatch(error: Error, errorInfo: any) {
    Sentry.withScope(scope => {
      scope.setExtras(errorInfo);
      Sentry.captureException(error);
    });

    super.componentDidCatch(error, errorInfo);
  }

  public render() {
    const { Component, pageProps } = this.props;

    return (
      <StrictMode>
        <Container>
          <ThemeProvider theme={colors}>
            <>
              <NProgress
                color={colors.primary}
{'fraction_non_alphanumeric': 0.1333547557840617, 'fraction_numerical': 0.0, 'mean_word_length': 3.4855907780979827, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6386343', 'n_tokens_mistral': 948, 'n_tokens_neox': 922, 'n_words': 216}