例外を無視する方法
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.