简体   繁体   English

如何处理错误处理系统中的错误?

[英]how to handle errors of error handling system?

I've been working on developing a java web service. 我一直在开发Java Web服务。 In this project I have an error handling system. 在这个项目中,我有一个错误处理系统。 My problem is what to do if the error handling system itself throws an exception(eg FileNotFoundExcption for the log file). 我的问题是,如果错误处理系统本身引发异常(例如,日志文件的FileNotFoundExcption),该怎么办。 Should it be swallowed? 应该吞下吗? or Should it be sent to user or something else. 或应将其发送给用户或其他东西。

_new information_________ _新的信息_________

In my older prjects when ever an exception is thrown. 在我的老项目中,每当抛出异常时。 1-system catch the exception. 1系统捕获异常。 2a- system return an appropriate message to the user. 2a-系统向用户返回一条适当的消息。 2b- System logs the exception with it's whole stack trace.this way the end user can inform the admin and admin sends me the error log. 2b-系统记录了异常及其整个堆栈跟踪。这样最终用户可以通知管理员,并且管理员向我发送错误日志。 my question is what if the system can't log the exception. 我的问题是,如果系统无法记录异常,该怎么办? in the past i would have send a second message to the user to inform the system admin about this. 在过去,我会向用户发送第二条消息以通知系统管理员。 I'm wondering if this is the right choice. 我想知道这是否是正确的选择。


Any kind of information is appreciated. 任何类型的信息,不胜感激。

It depends. 这取决于。 To catch or throw an exception, it all depends on the context in which exception occurs. 要捕获或引发异常,这全都取决于发生异常的上下文。

To answer your question If there is something that can be done with an exception, go ahead. 回答您的问题如果可以做一些例外处理,请继续。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM