当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browser.init函数代码示例

本文整理汇总了TypeScript中@sentry/browser.init函数的典型用法代码示例。如果您正苦于以下问题:TypeScript init函数的具体用法?TypeScript init怎么用?TypeScript init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了init函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

 constructor() {
   Sentry.init({
     dsn: "https://94f8a267877b4ab1a40aa5b379c9174e@sentry.io/1372016",
     environment: environment.production ? "production" : "development",
     release: environment.version,
   });
 }
开发者ID:xXKeyleXx,项目名称:MyPet-SkilltreeCreator,代码行数:7,代码来源:error-reporter.service.ts

示例2: init

(() => {

  // Desativa o plugin em localhost
  if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
    return;
  }

  const { REACT_APP_SENTRY_DSN, REACT_APP_VERSION, REACT_APP_NODE_ENV } = process.env;
  if (!REACT_APP_SENTRY_DSN) {
    return;
  }

  init({ dsn: REACT_APP_SENTRY_DSN, release: REACT_APP_VERSION, environment: REACT_APP_NODE_ENV });
  configureScope(scope => {
  });

})();
开发者ID:juninmd,项目名称:fatec-hospital-web,代码行数:17,代码来源:sentry.plugin.ts

示例3: constructor

// App
import { environment } from '../environments/environment';
export const firebaseConfig = environment.firebaseConfig;
import { AppRoutingModule } from './app-routing.module';
import { CoreModule } from './core/core.module';
import { RouterHelperService } from './_common/services/router-helper.service';

// Components
import { AppComponent } from './app.component';
import { HomeContentComponent } from './home-content/home-content.component';
import { DictionaryCardComponent } from './home-content/dictionary-card/dictionary-card.component';
import { UserStatusComponent } from './user-status/user-status.component';

import * as Sentry from '@sentry/browser';
Sentry.init({
  dsn: 'https://53fc9debca4949cba559c2800591d28c@sentry.io/1353120'
});

@Injectable()
export class SentryErrorHandler implements ErrorHandler {
  constructor() { }
  handleError(error) {
    Sentry.captureException(error.originalError || error);
    throw error;
  }
}

const providers: any[] = [
  RouterHelperService,
];
if (environment.production) {
开发者ID:jacobbowdoin,项目名称:RapidWords,代码行数:31,代码来源:app.module.ts

示例4: require

if ($featureFlags.sentry) {
  // The require instead of import helps us trim this from the production bundle
  // tslint:disable-next-line
  const Sentry = require('@sentry/browser');
  Sentry.init({
    dsn: 'https://1367619d45da481b8148dd345c1a1330@sentry.io/279673',
    release: $DIM_VERSION,
    environment: $DIM_FLAVOR,
    ignoreErrors: [
      'QuotaExceededError',
      'Time out during communication with the game servers.',
      'Bungie.net servers are down for maintenance.',
      "This action is forbidden at your character's current location.",
      "An unexpected error has occurred on Bungie's servers",
      /Destiny tracker service call failed\./,
      'Appel au service de Destiny tracker ĂŠchouĂŠ.',
      /You may not be connected to the internet/,
      'Software caused connection abort'
    ],
    ignoreUrls: [
      // Chrome extensions
      /extensions\//i,
      /^chrome:\/\//i,
      /^moz-extension:\/\//i
    ],
    attachStackTrace: true
  });

  reportException = (name: string, e: Error, errorInfo?: {}) => {
    // TODO: we can also do this in some situations to gather more feedback from users
    // Sentry.showReportDialog();
开发者ID:w1cked,项目名称:DIM,代码行数:31,代码来源:exceptions.ts

示例5: beforeSend

const loadRaven = process.env.NODE_ENV === 'production';
if (loadRaven) {
  Sentry.init({
    dsn: 'https://4b4fe71954424fd39ac88a4f889ffe20@sentry.io/213986',

    release: process.env.versionStr || 'UNKNOWN_RELEASE',

    beforeSend(event, hint) {
      const message = get(hint, ['originalException', 'message']);
      if (message && message.match(/top\.globals|canvas\.contentDocument/i)) {
        return null;
      }
      return event;
    },

    blacklistUrls: [
      // Local file system
      /^file:\/\//i,
      // Chrome and Firefox extensions
      /^chrome:\/\//i,
      /^chrome-extension:\/\//i,
      /^moz-extension:\/\//i,
      // UC Browser injected script
      /u\.c\.b\.r\.o\.w\.s\.e\.r/i,
      // Disqus
      /embed\.js$/i,
      /alfalfa\.[0-9a-f]+\.js$/i,
    ],
  });
}
开发者ID:nusmodifications,项目名称:nusmods,代码行数:30,代码来源:sentry.ts

示例6: beforeBreadcrumb

    event.exception.values[0].value
  ) {
    return event.exception.values[0].value
  }
  return ''
}
SentryLib.init({
  logLevel: 2,
  dsn: 'https://8e6ccc2ffded4a568f6f94ef870fa665@sentry.io/1427888',
  environment: APP_CONFIG.environment,
  beforeBreadcrumb(breadcrumb) {
    return breadcrumb.category === 'console' ? null : breadcrumb
  },
  beforeSend: event => {
    if (APP_CONFIG.environment === 'local') {
      logger.warn(
        `SENTRY EVENT: ${getEventMessage(event)}${
          event.tags ? ` ${JSON.stringify(event.tags)}` : ''
        }`,
        undefined,
        event,
      )
    }
    return event
  },
})

if (!isServerRendering()) {
  // @ts-ignore
  window.testError = () => SentryLib.captureMessage('test error')
}
开发者ID:travisbloom,项目名称:travisbloom.me,代码行数:31,代码来源:sentry.ts

示例7: handleError

import { Injectable } from '@angular/core';
import { IonicErrorHandler } from 'ionic-angular';
import * as SentryClient from '@sentry/browser';
import { APP_VERSION, isProdMode } from './config';

SentryClient.init({
  dsn: 'https://65d073d56d014385a2aca1276216cb91@sentry.io/300552',
  release: APP_VERSION,
  beforeSend: (event: SentryClient.Event & { culprit?: string }) => {
    if (event.culprit) {
      event.culprit = event.culprit.substring(event.culprit.lastIndexOf('/'));
    }
    const st: SentryClient.Stacktrace =
      event.stacktrace || (event.exception && event.exception[0] && event.exception[0].stacktrace);
    if (st) {
      st.frames.forEach(frame => {
        frame.filename = frame.filename.substring(frame.filename.lastIndexOf('/'));
      });
    }

    return event;
  },
});

export const MonitoringClient = SentryClient;

@Injectable()
export class MonitoringErrorHandler extends IonicErrorHandler {
  public handleError(err: any): void {
    if (!isProdMode() && err && err.message && err.message.indexOf('cordova_not_available') !== -1) {
      return;
开发者ID:ifiske,项目名称:iFiske,代码行数:31,代码来源:monitoring.ts

示例8: over

import { SENTRY_URL } from 'src/constants';
import redactAccessTokenFromUrl from 'src/utilities/redactAccessTokenFromUrl';

const updateRequestUrl = over(
  lensPath(['request', 'url']),
  redactAccessTokenFromUrl
);

const beforeSend: BrowserOptions['beforeSend'] = (event, hint) => {
  return updateRequestUrl(event);
};

if (SENTRY_URL) {
  init({
    dsn: SENTRY_URL,
    release: process.env.VERSION,
    environment: process.env.NODE_ENV,
    beforeSend
  });
}

window.addEventListener('unhandledrejection', (err: PromiseRejectionEvent) => {
  captureException(err.reason);
});

export const reportException = (error: string | Error, extra?: any) => {
  if (process.env.NODE_ENV === 'production' && SENTRY_URL) {
    captureException(error);
  } else {
    /* tslint:disable */
    console.error('====================================');
    console.error(error);
开发者ID:displague,项目名称:manager,代码行数:32,代码来源:exceptionReporting.ts

示例9: Vue

import Vue from "vue"
import PimpyTask from "./components/pimpy_task.vue"
import * as Sentry from '@sentry/browser';

declare var SentryConfig: Sentry.BrowserOptions;

SentryConfig.integrations = [new Sentry.Integrations.Vue()];

Sentry.init(SentryConfig);


// Pimpy version, cannot use render function yet as we define custom element in
// Jinja e.g. <tr is="pimpy-task" :id="..." ...></tr>.
if (document.querySelector('#pimpy_app')) {
    console.log("Pimpy app has been detected.");

    new Vue({
        el: '#pimpy_app',
        components: {
            'pimpy-task': PimpyTask
        },
        // render: h => h(PimpyApp)

    })
}
开发者ID:viaict,项目名称:viaduct,代码行数:25,代码来源:index.ts


注:本文中的@sentry/browser.init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。