opencaesar / owl-tools

A set of analysis tools for OWL
Apache License 2.0
5 stars 1 forks source link

owlQuery returns success status from exception #22

Closed dwagmuse closed 3 years ago

dwagmuse commented 3 years ago

Description

If a query fails due to an exception thrown by the actual execution the task returns a default success status to gradle making gradle think it succeeded

Steps to Reproduce

Steps to reproduce the behavior:

Expected Behavior

Relevant screenshots

If applicable, add screenshots to help illustrate the issue.

dwagmuse commented 3 years ago

I think the problem in owlQuery is that the exception handler for execution at line 158 https://github.com/opencaesar/owl-tools/blob/master/owl-query/src/main/java/io/opencaesar/owl/query/OwlQueryApp.java only prints a stack trace and then falls through to the default exit which will return a successful status. It should signal a failed return status at that point.

dwagmuse commented 3 years ago

I’m less familiar with how scala does this but the render task appears to have exactly the same problem (in analysis tools): it collects and emits the error messages but it always exits with a default status.

It's also easy to see how a mistake like this could be made as the gradle documentation explaining how to write tasks fails to even mention that there IS a FAILED return status:

https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:task_outcomes

(there is, https://docs.gradle.org/current/javadoc/org/gradle/testkit/runner/TaskOutcome.html#FAILED)

But the documentation says absolutely NOTHING about error handling.

dwagmuse commented 3 years ago

Actually, now that I look at the code I see a lot more cases where exceptions are being suppressed. The code is suppressing just about every possible error and will need a more significant restructuring.

melaasar commented 3 years ago

Addressed as in v0.9.6