• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

when and how to design your own custom exception handling mechanism ?

 
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how do we come to know that we need our own exception classes for exception handling mechanism for an application ? how this need is and should be identified ? what other things to keep in mind while designing exception handling mechanism for an application ?

i'm asking this because we have a web application in ejb 3/ jpa. our senior asked me that we should have good exception handling mechanism for the project. right now we are just catching the exceptions and logging the same. i know this is not good since we should catch/handle the exception in a proper way relevant to the problem domain. are there any other frameworks out there for such tasks ? also does exception handling can be regarded as cross cutting problem/aspect ?
 
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gurpreet, As far as my understanding any exception checked or unchecked should be logged which should be parsed on daily basis and generate alerts for the tech and qa team, so that neccessary actions can be taken.
Although there will be so many exceptions for which nothing much can be done like wrong passwords tries, db connection wait time.
But logging this exception will give you broader understanding of your system in live production, after which you can apply different solutions like Throttling or logging levels.

In one hand where it is giving you insight into the system behavior, user of the system should be notified for the problems that your system is facing and will be related to your domain. Like if i am asking user to upload a file and somehow my disk usage has reahced its limit, i would like to show a business exception "We don't have enough disk space for your upload, we are fixing it". This will instill a lot of user faith in your system. Likewise if Booking is done but somehow you are unable to give voucher now show this relevant message.

so to sum up you will have two kinds of exception is your system one is application exception for logging and one is Business exceptions for users.

I am not aware of any framework as such, because this is domain specific. Hope this will help.
 
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic