• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception Propogation between Layers

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic