Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

Exceptions need more granular types #277

Closed
james-whiteside opened this issue Jan 10, 2023 · 1 comment
Closed

Exceptions need more granular types #277

james-whiteside opened this issue Jan 10, 2023 · 1 comment

Comments

@james-whiteside
Copy link

Problem to Solve

Exceptions need more granular types.

E.g. I run the query match $t sub {my_type}; with a user-defined string my_type. If I get TypeDBClientException, is it because the type my_type does not exist in the database, or because the string my_type contains illegal query characters? I should be able to try/except individually for these cases. Other similar cases exist, where currently most errors seem to just be TypeDBClientExceptions.

Current Workaround

I could process the exception message to get more information about the error as they seem to already be loosely typed. With reference to the above example, compare:

typedb.common.exception.TypeDBClientException: [TYR03] Invalid Type Read: The type 'relations' does not exist.
typedb.common.exception.TypeDBClientException: [TQL03] TypeQL Error: There is a syntax error at line 1:

but this is both inelegant and has potential for unintended behaviour.

Proposed Solution

Make exceptions more strongly typed.

@alexjpwalker
Copy link
Member

Proposal to extend our gRPC error architecture (which would fix this issue):

Closing as entirely covered by that!

@alexjpwalker alexjpwalker closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants