You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Sergey Dudoladov (JIRA)" <ji...@apache.org> on 2016/01/29 12:55:39 UTC
[jira] [Comment Edited] (REEF-864) Make exception handling
consistent
[ https://issues.apache.org/jira/browse/REEF-864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15123382#comment-15123382 ]
Sergey Dudoladov edited comment on REEF-864 at 1/29/16 11:55 AM:
-----------------------------------------------------------------
We've done most of the things from the [original list | https://issues.apache.org/jira/browse/REEF-864?focusedCommentId=15062154&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15062154] except:
{quote}
Forbid throwing general exceptions: Error, RuntimeException, Throwable, Exception.
{quote}
The current checks allow to catch and throw {{java.lang.Exception}}. We seem to use this class often, so I decided to allow it to avoid numerous false positives.
{quote}
Each exception must have a non-empty message.
{quote}
At present, there are no checks for this.
{quote}
Log and (re)throw. Doing both at the same time is sometimes considered an antipattern
{quote}
On the mailing list, we agreed to log at the topmost level and rethrow everywhere else. However,
this seems to be a very significant change, and I am reluctant to do it in one go.
{quote}
Forbid catch blocks that contain only log statements.
{quote}
This is effectively exception swallowing. AFAIK, there are no checks for this too.
I suggest we lazily fix these issues during code reviews.
was (Author: dss-2009@yandex.ru):
We've done most of the things from the [original list | https://issues.apache.org/jira/browse/REEF-864?focusedCommentId=15062154&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15062154] except:
{quote}
Forbid throwing general exceptions: Error, RuntimeException, Throwable, Exception.
{quote}
The current checks allow to catch and throw {{java.lang.Exception}}. We seem to use this class often, so I decided to allow it to avoid numerous false positives.
{quote}
Each exception must have a non-empty message.
{quote}
At present, there are no checks for this.
{quote}
Log and (re)throw. Doing both at the same time is sometimes considered an antipattern
{quote}
On the mailing list, we agreed to log at the topmost level and rethrow everywhere else. However,
this seems to be a very significant change, and I am reluctant to do it in one go.
{quote}
Forbid catch blocks that contain only log statements.
{quote}
This is effectively exception swallowing. AFAIK, there are no checks for this too.
I suggest we lazily fix this issues during code reviews.
> Make exception handling consistent
> ----------------------------------
>
> Key: REEF-864
> URL: https://issues.apache.org/jira/browse/REEF-864
> Project: REEF
> Issue Type: Improvement
> Components: Build infrastructure, Documentation
> Reporter: Sergey Dudoladov
> Assignee: Sergey Dudoladov
>
> The recent [OSDI paper | https://www.usenix.org/conference/osdi14/technical-sessions/presentation/yuan] suggest that many failures in distributed systems arise from 3 trivial mistake in exception handling:
> 1) the handler is empty
> 2) the handler silently aborts
> 3) the handler contains phrases like “TODO” and “FIXME”, i.e. is knowingly incomplete
> The authors propose [their own checker|https://github.com/diy1/aspirator] for these cases, but we can try to enforce any of these rules via checkstyle, for example.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)