本文整理汇总了TypeScript中raven-js.captureMessage函数的典型用法代码示例。如果您正苦于以下问题:TypeScript captureMessage函数的具体用法?TypeScript captureMessage怎么用?TypeScript captureMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了captureMessage函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: logWarning
logWarning(message: string): void {
if (this.config.isLocal) {
console.warn(message);
} else {
Raven.captureMessage(message, {level: 'warning'});
}
}
示例2: handleError
handleError(err) {
let error: any = null;
let message: any = null;
if (err instanceof CustomError) {
error = err.originalError;
message = err.message;
} else {
error = err;
}
if (error instanceof HttpErrorResponse) {
message = 'BACKEND: ' + message
switch (error.status) {
case 0: {
error = new UnreachableError(error.error);
message = message + ' - Unreachable Error';
break;
}
case 400: {
error = new BadInputError(error.error);
message = message + ' - Bad Input Error';
break;
}
case 403: {
error = new ForbiddenError(error.error);
message = message + ' - Forbidden Error';
break;
}
case 404: {
error = new NotFoundError(error.error);
message = message + ' - Not Found Error';
break;
}
default: {
error = new BaseError(error.error)
message = message + ' - Base Error';
break;
}
}
} else if (error instanceof Error) {
message = 'FRONTEND: ' + message
// Additional processing for GENERAL exceptions
} else {
// For anything else
}
console.log(error);
console.log(message);
Raven.captureMessage(error, {
level: 'info',
extra: {
error: error,
message: message,
}
});
}
示例3: report
export function report(userFeedback: string, feedbackCategory: string, userEmail?: string): void {
if (!Raven.isSetup()) {
throw new IllegalStateError('Error reporter not initialized.');
}
Raven.setUserContext({email: userEmail || ''});
Raven.captureMessage(userFeedback, {tags: {category: feedbackCategory}});
Raven.setUserContext(); // Reset the user context, don't cache the email
}
示例4: logResponse
logResponse(message: string, response: Response) {
if (this.config.isLocal) {
// TODO: handle text or blob responses
console.info(`${response.status}: ${JSON.stringify(response.json())}`)
} else {
const options: any = {
level: 'error',
extra: {'response': response}
};
Raven.captureMessage(message, options)
}
}
示例5: report
report(userFeedback: string, feedbackCategory: string, userEmail?: string): Promise<void> {
Raven.setUserContext({email: userEmail || ''});
Raven.captureMessage(userFeedback, {tags: {category: feedbackCategory}});
Raven.setUserContext(); // Reset the user context, don't cache the email
return Promise.resolve();
}
示例6: ravenCaptureMessage
protected ravenCaptureMessage(message: string,
options: RavenOptions) {
Raven.captureMessage(message, options);
}