Forum Stats

  • 3,875,456 Users
  • 2,266,916 Discussions


Exception Handling


I am creating a web service for which I need a framework for Exception Handling which I can use in my future projects as well. Please provide ideas or a sample structure.

Many thanks!


  • jschellSomeoneStoleMyAlias
    jschellSomeoneStoleMyAlias Member Posts: 24,877 Gold Badge
    One idea is that I doubt that is viable.

    Attempting a one size fits all solution to exception handling is unlikely to work.

    Now if there is a specific small problem domain to be addressed that might be doable.
  • dadams07
    dadams07 Member Posts: 1,310
    Some general thoughts: Consider whether it makes sense to set up error categories (i.e., base classes) for (1) warnings (2) transient errors (ones that might go away on a retry) or (3) fatal errors (ones you're pretty sure will require human intervention). My personal philosophy is that it makes sense to declare different exception types only if I handle them differently, or if the error types themselves give information about the cause or location of the problem.
This discussion has been closed.