java - The use of checked exception for errors to be dealt with in web layer -


I have a hard time managing handling of errors in service time, in this method to throw the exception The reason is that when providing password is vulnerable or the confirmation ID is incorrect. The name of the exception is not yet decided.

However, are there any exceptions to avoiding any new applications? If so, how do I approach such errors from the collar? In this scenario, the caller is the web layer that displays a web service. I want to handle the error in the web layer and prepare an error message.

I have a method:

  Confirm boolean password reset (Intit Account ID, String Confirmation ID, String Nupsword);  

And this is an exception class:

  Public class ban objection exceptions {public obligation violation (string message) (super message) is extracted; }}  

This article looks like it should be correct:

contingency

  • is considered A part of the design
  • It is expected to happen: Regularly but rarely
  • Who cares about it: The upstream code that includes the example : Optional return mode
  • Best mapping: a check exception

I try to use As little as possible, I think it is enough to use a runtime exception and document it clearly.

From your case, you design and control the web layer. In that case, you already know how your service level has been given an exception and how to handle them you do not need to be told by the compiler.

Only one check exception is used when the exception is recoverable, and the client of the code is external where I have to force the exception to handle. Nevertheless, the result would be one more empty catch block.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -