You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by Douglas Service <ds...@gmail.com> on 2017/06/04 03:40:38 UTC

REEF error propagation standard

Is there any documentation on error handling standards in REEF? For example
when should one throw and exception and when should one log the error? I
have put out a pull request for REEF-1763, but I think error handling may
need to be addressed to make it more consistent with current REEF standards.

Doug

RE: REEF error propagation standard

Posted by "Julia Wang (QIUHE)" <Qi...@microsoft.com.INVALID>.
In .Net, we used to use Org.Apache.REEF.Utilities.Diagnostics.Exceptions to enforce the exception handling rules and error logs. As there is a drawback in using this utility from language perspective, we now plan to remove it and use language Exception classes directly. But I think the rules should be still the same. 

Julia


-----Original Message-----
From: Markus Weimer [mailto:markus@weimo.de] 
Sent: Monday, June 5, 2017 10:57 AM
To: REEF Developers Mailinglist <de...@reef.apache.org>
Subject: Re: REEF error propagation standard

In Java, we have agreed upon a few rules, some of which are codified in our checkstyle tests. IIRC, they are:

  * We do not allow empty `catch` blocks
  * When throwing an exception from a `catch` block, add the causing exception.
  * Do not log exceptions in a `catch` block unless you handle them.
  * Do not log exceptions where you throw them.

The latter two rules make sure that we, in theory, log every exceptions exactly once: Either at the place where it is handled or by the JVM when that exception crashes the JVM.

Markus

On Sun, Jun 4, 2017 at 7:11 AM, Saikat Kanjilal <sx...@gmail.com> wrote:
> How about this?
>
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fjavare
> visited.blogspot.com%2F2013%2F03%2F0-exception-handling-best-practices
> -in-Java-Programming.html%3Fm%3D1&data=02%7C01%7CQiuhe.Wang%40microsof
> t.com%7Cfc8bdf0c0a8b46c839a108d4ac3c5ef6%7C72f988bf86f141af91ab2d7cd01
> 1db47%7C1%7C0%7C636322822673004792&sdata=oLF3Ikqkg8AV7CiMCe2JU547vAfy6
> qe8k%2BQFVqv1zNk%3D&reserved=0
>
> Hope it helps.
>
> Sent from my iPhone
>
>> On Jun 4, 2017, at 6:01 AM, Byung-Gon Chun <bg...@gmail.com> wrote:
>>
>> A good guideline on Java programming is Effective Java (2nd ed.).
>> Do we have a similar book related to .NET (say Effective .NET)?
>>
>> -Gon
>>
>>> On Sun, Jun 4, 2017 at 9:33 PM, Byung-Gon Chun <bg...@gmail.com> wrote:
>>>
>>> Hi Doug,
>>>
>>> I don't think we have *formal* exception handling rules.
>>> The following stack overflow page shows a set of good rules.
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsta
>>> ckoverflow.com%2Fquestions%2F3551221%2Fguidelines-&data=02%7C01%7CQi
>>> uhe.Wang%40microsoft.com%7Cfc8bdf0c0a8b46c839a108d4ac3c5ef6%7C72f988
>>> bf86f141af91ab2d7cd011db47%7C1%7C0%7C636322822673004792&sdata=hiwbOZ
>>> 8f06yUAG5pLER0vhzNAdM6z%2F3fwIvQCxO5ruQ%3D&reserved=0
>>> on-exception-propagation-in-java
>>>
>>> Thanks!
>>> -Gon
>>>
>>> On Sun, Jun 4, 2017 at 12:40 PM, Douglas Service <ds...@gmail.com>
>>> wrote:
>>>
>>>> Is there any documentation on error handling standards in REEF? For 
>>>> example when should one throw and exception and when should one log 
>>>> the error? I have put out a pull request for REEF-1763, but I think 
>>>> error handling may need to be addressed to make it more consistent 
>>>> with current REEF standards.
>>>>
>>>> Doug
>>>>
>>>
>>>
>>>
>>> --
>>> Byung-Gon Chun
>>>
>>
>>
>>
>> --
>> Byung-Gon Chun

Re: REEF error propagation standard

Posted by Markus Weimer <ma...@weimo.de>.
In Java, we have agreed upon a few rules, some of which are codified
in our checkstyle tests. IIRC, they are:

  * We do not allow empty `catch` blocks
  * When throwing an exception from a `catch` block, add the causing exception.
  * Do not log exceptions in a `catch` block unless you handle them.
  * Do not log exceptions where you throw them.

The latter two rules make sure that we, in theory, log every
exceptions exactly once: Either at the place where it is handled or by
the JVM when that exception crashes the JVM.

Markus

On Sun, Jun 4, 2017 at 7:11 AM, Saikat Kanjilal <sx...@gmail.com> wrote:
> How about this?
>
> http://javarevisited.blogspot.com/2013/03/0-exception-handling-best-practices-in-Java-Programming.html?m=1
>
> Hope it helps.
>
> Sent from my iPhone
>
>> On Jun 4, 2017, at 6:01 AM, Byung-Gon Chun <bg...@gmail.com> wrote:
>>
>> A good guideline on Java programming is Effective Java (2nd ed.).
>> Do we have a similar book related to .NET (say Effective .NET)?
>>
>> -Gon
>>
>>> On Sun, Jun 4, 2017 at 9:33 PM, Byung-Gon Chun <bg...@gmail.com> wrote:
>>>
>>> Hi Doug,
>>>
>>> I don't think we have *formal* exception handling rules.
>>> The following stack overflow page shows a set of good rules.
>>> https://stackoverflow.com/questions/3551221/guidelines-
>>> on-exception-propagation-in-java
>>>
>>> Thanks!
>>> -Gon
>>>
>>> On Sun, Jun 4, 2017 at 12:40 PM, Douglas Service <ds...@gmail.com>
>>> wrote:
>>>
>>>> Is there any documentation on error handling standards in REEF? For
>>>> example
>>>> when should one throw and exception and when should one log the error? I
>>>> have put out a pull request for REEF-1763, but I think error handling may
>>>> need to be addressed to make it more consistent with current REEF
>>>> standards.
>>>>
>>>> Doug
>>>>
>>>
>>>
>>>
>>> --
>>> Byung-Gon Chun
>>>
>>
>>
>>
>> --
>> Byung-Gon Chun

Re: REEF error propagation standard

Posted by Saikat Kanjilal <sx...@gmail.com>.
How about this?

http://javarevisited.blogspot.com/2013/03/0-exception-handling-best-practices-in-Java-Programming.html?m=1

Hope it helps.

Sent from my iPhone

> On Jun 4, 2017, at 6:01 AM, Byung-Gon Chun <bg...@gmail.com> wrote:
> 
> A good guideline on Java programming is Effective Java (2nd ed.).
> Do we have a similar book related to .NET (say Effective .NET)?
> 
> -Gon
> 
>> On Sun, Jun 4, 2017 at 9:33 PM, Byung-Gon Chun <bg...@gmail.com> wrote:
>> 
>> Hi Doug,
>> 
>> I don't think we have *formal* exception handling rules.
>> The following stack overflow page shows a set of good rules.
>> https://stackoverflow.com/questions/3551221/guidelines-
>> on-exception-propagation-in-java
>> 
>> Thanks!
>> -Gon
>> 
>> On Sun, Jun 4, 2017 at 12:40 PM, Douglas Service <ds...@gmail.com>
>> wrote:
>> 
>>> Is there any documentation on error handling standards in REEF? For
>>> example
>>> when should one throw and exception and when should one log the error? I
>>> have put out a pull request for REEF-1763, but I think error handling may
>>> need to be addressed to make it more consistent with current REEF
>>> standards.
>>> 
>>> Doug
>>> 
>> 
>> 
>> 
>> --
>> Byung-Gon Chun
>> 
> 
> 
> 
> -- 
> Byung-Gon Chun

Re: REEF error propagation standard

Posted by Byung-Gon Chun <bg...@gmail.com>.
A good guideline on Java programming is Effective Java (2nd ed.).
Do we have a similar book related to .NET (say Effective .NET)?

-Gon

On Sun, Jun 4, 2017 at 9:33 PM, Byung-Gon Chun <bg...@gmail.com> wrote:

> Hi Doug,
>
> I don't think we have *formal* exception handling rules.
> The following stack overflow page shows a set of good rules.
> https://stackoverflow.com/questions/3551221/guidelines-
> on-exception-propagation-in-java
>
> Thanks!
> -Gon
>
> On Sun, Jun 4, 2017 at 12:40 PM, Douglas Service <ds...@gmail.com>
> wrote:
>
>> Is there any documentation on error handling standards in REEF? For
>> example
>> when should one throw and exception and when should one log the error? I
>> have put out a pull request for REEF-1763, but I think error handling may
>> need to be addressed to make it more consistent with current REEF
>> standards.
>>
>> Doug
>>
>
>
>
> --
> Byung-Gon Chun
>



-- 
Byung-Gon Chun

Re: REEF error propagation standard

Posted by Byung-Gon Chun <bg...@gmail.com>.
Hi Doug,

I don't think we have *formal* exception handling rules.
The following stack overflow page shows a set of good rules.
https://stackoverflow.com/questions/3551221/guidelines-on-exception-propagation-in-java

Thanks!
-Gon

On Sun, Jun 4, 2017 at 12:40 PM, Douglas Service <ds...@gmail.com> wrote:

> Is there any documentation on error handling standards in REEF? For example
> when should one throw and exception and when should one log the error? I
> have put out a pull request for REEF-1763, but I think error handling may
> need to be addressed to make it more consistent with current REEF
> standards.
>
> Doug
>



-- 
Byung-Gon Chun