當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript raven-js.captureMessage函數代碼示例

本文整理匯總了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'});
     }
 }
開發者ID:finleysg,項目名稱:bhmc,代碼行數:7,代碼來源:bhmc-error-handler.service.ts

示例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,
            }
        });
    }
開發者ID:faxad,項目名稱:cartify,代碼行數:59,代碼來源:app-error-handler.ts

示例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
 }
開發者ID:fang2x,項目名稱:outline-server,代碼行數:8,代碼來源:error_reporter.ts

示例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)
     }
 }
開發者ID:finleysg,項目名稱:bhmc,代碼行數:12,代碼來源:bhmc-error-handler.service.ts

示例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();
 }
開發者ID:fang2x,項目名稱:outline-client,代碼行數:6,代碼來源:error_reporter.ts

示例6: ravenCaptureMessage

 protected ravenCaptureMessage(message: string,
                               options: RavenOptions) {
   Raven.captureMessage(message, options);
 }
開發者ID:NGO-DB,項目名稱:ndb-core,代碼行數:4,代碼來源:logging.service.ts


注:本文中的raven-js.captureMessage函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。