• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception Propogation between Layers  RSS feed

Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I tried to design the application into multiple layers:
1. Database Layer
2. Business Layer
3. Interface Later

in DB layer I made sure that the interface is maintained as much as possible and whenever I needed to add a new exception it would be an unchecked exception as explained in the threads.

the question is: Data class raises RecordNotFound, RecordNotLocked and some other exceptions, I know that I should raise business exceptions in the business layer... something that is more abstract. Possible alternatives:

1. I find it in convenient to raise one Business exception (say BusinessException) and wrap Data exceptions with that exception.
2. another option that I can think of is creating more than one business layer exception one of RecordNotFoundException (can't think of an abstract name for that one!), one for RecordNotLockedException (may be SecurityException is little more abstract) and so on.
3. the third option is just throwing the same exceptions to the GUI and make the GUI handle them (using GUIException similar to what's done in Monkhouse's book).

any suggestions are welcome.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!