Skip to content

Decide how we want to throw/capture error during execution #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zyang-tudb opened this issue Aug 11, 2022 · 2 comments
Open

Decide how we want to throw/capture error during execution #252

zyang-tudb opened this issue Aug 11, 2022 · 2 comments
Assignees

Comments

@zyang-tudb
Copy link
Contributor

There could be error during execution, either because internal problem or invalid query (for example skip with expression evaluated to zero or negative int). We need to think about how we want to throw and capture execution errors. Exception is one way, but I'm not sure whether it's the best.

@LianxinGao
Copy link
Contributor

neo4j will give a exception:

match (n:Person) return n skip -1
Invalid input '-1' is not a valid value, must be a positive integer (line 1, column 32 (offset: 31))
"match (n:Person) return n skip -1"

@zyang-tudb
Copy link
Contributor Author

There are two options:

  • try-catch-finally This looks similar to Java's. However, Scala has no CheckedException, meaning we cannot declare types of Exception that might be thrown from a function or have the guarantee that all thrown Exceptions will be handled.
  • Try-Success-Failure This requires a function that might generate error to return a Try object. Try object can be Success or Failure. Caller have to match Try to either Success or Failure. This guarantees all possible Exceptions can be handled as long as we don' convert Try to Success by force.

IMO we should take the second approach.

@terrytangyuan terrytangyuan removed their assignment Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants