bixi
Version:
企业级中后台前端解决方案
30 lines (26 loc) • 900 B
text/typescript
import { ErrorHandler, Injectable } from '@angular/core';
import * as Sentry from '@sentry/browser';
import { version } from '../../../../package.json';
import { environment } from '../../../environments/environment';
if (!environment.production) {
Sentry.init({
dsn: 'http://f00059573fa7406ab934b42fac22e80f@starport.datagrand.com/49',
release: version
});
}
()
export class SentryService implements ErrorHandler {
// tslint:disable-next-line: no-any
handleError(err: any): void {
if (!environment.production) {
console.error(err);
return;
}
const eventId = Sentry.captureException(err.originalError || err);
Sentry.showReportDialog({
title: '看起来好像出了一些错误',
errorFormEntry: '有一些字段是缺失的,我们希望您完整填写以帮助我们更好定位问题,谢谢~',
eventId
});
}
}