예외 무시 방법
Contents
[
Hide
]
예외 무시 지원
ExceptionManager 클래스는 예외 무시 기능을 제공합니다:
코드 예제:
예외를 처리하는 콜백을 설정하세요:
ExceptionManager.setIgnoreExceptionsHandler(new IgnoreExceptionsCallback() {
//exception path: {Module}\{Method}\{Action}\{GUID}
//example: MailMessage\Load\DecodeTnefAttachment\64149867-679e-4645-9af0-d46566cae598
public boolean invoke(AsposeException ex, String path) {
//Ignore all exceptions on MailMessage.Load
return path.equals("MailMessage\\Load");
}
});
또는 대안을 사용하십시오:
//Ignore all exceptions
ExceptionManager.setIgnoreAll(true);
또한, 무시된 예외 로그에 대한 콜백을 설정할 수 있습니다:
ExceptionManager.setIgnoreExceptionsLogHandler(new IgnoreExceptionsLogCallback() {
public void invoke(String message) {
System.out.println("=== EXCEPTION IGNORED === " + message);
}
});
사용자에게 예외를 무시해도 된다는 오류 메시지가 표시됩니다. 예시:
Exceptioin message:
AsposeArgumentException: properties should not be empty.
If you want to ignore an exception and want to proceed further then you can use:
ExceptionManager.getIgnoreList().add("MailMessage\\Load\\DecodeTnefAttachment\\64149867-679e-4645-9af0-d46566cae598")
Invalid TNEF Attachment will be interpreted as regular attachment.