我正在使用一个全局错误处理程序,它现在只使用console.log。当我从我的弹簧控制器得到一个例外,如下所示,我想在控制台上记录它。但是当我记录错误时,我得到以下消息
Chrome控制台
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Eclipse控制台
Sep 26, 2017 4:16:09 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [springmvc-dispatcher] in context with path threw exception [Request processing failed; nested exception is org.ektorp.UpdateConflictException: document update conflict: id: unknown rev: unknown] with root cause
org.ektorp.UpdateConflictException: document update conflict: id: unknown rev: unknown
我想向用户展示真正的异常,但我得到的只是内部服务器错误。
错误处理程序
import { ErrorHandler, Injectable } from '@angular/core';
import { GlobalMessageService } from 'app/service/messageService';
import { EGlobalModal } from 'app/model/eGlobalModal';
@Injectable()
export class GlobalErrorHandler implements ErrorHandler{
constructor(private _msgService:GlobalMessageService){
}
handleError(error){
console.log("error",error);
}
}