• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a question about throw exception

 
lijun wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do I need throw the exception which I catched in DAO to high level, like facade? if the answer is yes, why?
Thanks.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lijun,
Yes. You can throw the same exception or wrap it in a custom exception.

If the database layer doesn't throw an exception, how does your code know something is wrong?
 
lijun wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so thorw exception to high level is to keep the trace when I debug the code, is that right?
thanks.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lijun ,
Throwing the same exception keeps the strack trace. Throwing a different exception stars a new stack trace.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic