[ 
https://issues.apache.org/jira/browse/DRILL-5057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15684369#comment-15684369
 ] 

Deneche A. Hakim commented on DRILL-5057:
-----------------------------------------

I'm not sure making UserException checked will improve operator cleanup, how 
about other unchecked exceptions ?
The main reason UserException are left unchecked is to make it easier to fix 
error messages with the smallest set of changes, otherwise, for every error 
message we want to fix, we could potentially have to change a hundred places to 
ensure UserException are propagated back to the FragmentExecutor.

> 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:
> {code}
> public void foo( ) throws ACheckedException ...
> {code}
> 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
(v6.3.4#6332)

Reply via email to