Re: [Dev] What is the standard way of handling exceptions

2014-10-15 Thread Udara Liyanage
Hi, Logging and throwing is considered an anti pattern in some places since same exception will be logged in multiple locations. They recommend to wrap the exception and throw. catch(LowLevelException e){ throw new HighlevelException(Highlevel operation failed etc , e) } Then

Re: [Dev] What is the standard way of handling exceptions

2014-10-12 Thread Firzhan Naqash
Hi, As a standard practice we either throw the exception or log an error and continue the operation. If that exception will cause serious inconsistency in the entire functionality as a best practice we threw the exception. Other wise we can log error and continue the operation. As Dinesh

Re: [Dev] What is the standard way of handling exceptions

2014-10-12 Thread Roshan Deniyage
Hi, I think we need to catch exceptions, only if we can handle it or if we need to add more contextual information to the exception. In second case, creating new exception with more contextual information and throw it is okay. But, in that scenario, should not log and let the message is being

Re: [Dev] What is the standard way of handling exceptions

2014-10-11 Thread Ravindra Ranwala
Hi Dinesh, The way you handle an Exception is subjective and depends on the context. But there is one important thing to note. That is never ever do something like this unless you have an extremely valid reason. try{ // Some code goes here // } catch (Exception ignored) { //

Re: [Dev] What is the standard way of handling exceptions

2014-10-09 Thread Waruna Perera
Hi Danesh, In integration tests we used to log the exception and throw it. The reason is the result will be included in the testng reports. Thanks On Wed, Oct 8, 2014 at 9:24 AM, Danesh Kuruppu dan...@wso2.com wrote: One more question, why we do both log exception and throw it inside

Re: [Dev] What is the standard way of handling exceptions

2014-10-07 Thread Danesh Kuruppu
One more question, why we do both log exception and throw it inside handleException?. It will result in multiple log messages in log file, for a single problem in the code. On Thu, Oct 2, 2014 at 9:32 AM, Dinesh J Weerakkody dine...@wso2.com wrote: Hi, I'm just curious about the stranded way

[Dev] What is the standard way of handling exceptions

2014-10-01 Thread Dinesh J Weerakkody
Hi, I'm just curious about the stranded way of handling exceptions in WSO2 products. When I go through source code, I found that we use handleException method in some places (in some places use deferent method such as create new exceptions, catch, log and ignore, etc.) Can someone explain the