Closed danielmewes closed 9 years ago
See https://github.com/rethinkdb/rethinkdb/issues/4544 for the naming discussion.
I'm working on this one, but there are a couple points of minor mystification.
Will ReqlRuntimeError
itself ever be returned now, rather than one of its more specific subclasses?
Will ReqlAvailabilityError
ever be returned rather than a more specific 'ReqlOp...Error`?
While I assume ReqlCompileError
means the query can't be compiled, what's an example of when this would come up in practice?
The answer to the first two questions is no. You will always get one of the more specific sub types.
A typical example for a ReqlCompileError
would be passing the wrong number of arguments to a term, or passing an unrecognized optional argument. Another example is using a write operation inside of a for_each
.
I tried r.table('games').filter()
in version 2.0.3's data explorer earlier today and it returns an RqlDriverError
, which I assumed was, more or less, "the driver can't serialize this query properly." Will this be a CompileError
in 2.1, or is it going to be somewhat driver-dependent?
Ah yes, I don't think this changed in 2.1.
The different drivers have different amounts of information on the valid number of arguments built in, so some of them might still generate a ReqlDriverError
in this case.
ReQL queries in 2.1 can throw more specific error classes than before (https://github.com/rethinkdb/rethinkdb/issues/4296). The current list of error types can be found here https://github.com/marshall007/rethinkdb/blob/marshall_4472_js/drivers/javascript/errors.coffee#L24-L38 . However we might want to change the names of these error types a bit before the final release. Also note that this isn't implemented in the Python driver yet.
We need to document these new error types and their type hierarchy somewhere. Any suggestions for a suitable place to put these?
(http://docs.rethinkdb.com/2.1/docs/consistency/ also currently states "you can examine the error message", which we should change to checking the error type)