drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-5057) UserException is unchecked, but is the primary way to report errors
Date Mon, 21 Nov 2016 17:23:59 GMT
Paul Rogers created DRILL-5057:

             Summary: UserException is unchecked, but is the primary way to report errors
                 Key: DRILL-5057
                 URL: https://issues.apache.org/jira/browse/DRILL-5057
             Project: Apache Drill
          Issue Type: Improvement
    Affects Versions: 1.8.0
            Reporter: Paul Rogers
            Priority: Minor

Java provides two flavors of exceptions: checked and unchecked. Checked exceptions must be
declared by any method that can throw them:

public void foo( ) throws ACheckedException ...

Unchecked exceptions derive from Java's {{RuntimeException}} class and do not need such a
declaration. Unchecked exceptions are supposed to handle program-error kinds of conditions:
illegal states, array out of bounds -- the kind of thing that would clutter the code for errors
that should never occur in working code. (See the [Java docs|https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html].)

Drill's {{UserException}} class is the primary way to report that something went wrong. As
a result, every operator should catch the exception and do necessary clean-up and termination.
Yet, the exception is unchecked.

To ensure proper clean-up, migrate {{UserException}} to be checked. To help the migration,
perhaps define a new {{ExecutionException}} class that is checked, along with a new {{buildChecked}}
method in the "builder". Then, over time, migrate all user exceptions to the new, checked
version and ensure that proper cleanup is done.

This message was sent by Atlassian JIRA

View raw message