Reviewing Exception Handling

Reviewing Exception Handling

When developing an application it can be hard enough to get the happy path working, let alone worry about what might happen when something goes wrong.
I have asked a number of developers recently what they do when they get an exception and usually they log it or pass it back to the user.
What are some alternatives? If you have to pass on the exception how might you do that?

Read more by following this link to the new blog!

Comments

  1. It depends on the context and what your customer expects. I will differentiate between 3 type of editions:
    1. the ones that can be solved by the customer, like a NumberFormatException from a customer data.
    2. The ones that customer cannot do anything like a NullPointerException.
    3. Others we can retry, like the dependency is not available.

    So for 3 I will not show them to customer unless they are persistent, in which case they become exceptions of type 2.
    For type 1 you need to show to the customer and I will not log anything, obviously you need to catch it.
    For type 2 you should show to customer as well and potentially with a way to report the error.

    ReplyDelete



  2. I saw lot of information On Other Site But this blog helped me alot to learn Java Thanks for sharing.........

    ReplyDelete
  3. Is this blog dead? no posts since Mar.2017

    ReplyDelete
    Replies
    1. Please follow the links to my new blog, though the last post was the end of May, I have more posts planned.

      Delete

Post a Comment

Popular posts from this blog

Low Latency Microservices, A Retrospective

Unusual Java: StackTrace Extends Throwable

System wide unique nanosecond timestamps