本文整理匯總了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,
});
}
示例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 => {
});
})();
示例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) {
示例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();
示例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,
],
});
}
示例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')
}
示例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;
示例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);
示例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)
})
}