fauna / fauna-shell

Interactive shell for FaunaDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FE-2671] `shell` and `eval` throw error if handling error not an FaunaHTTPError

ptpaterson opened this issue · comments

Error handling for the shell and eval commands assumes that the error contains a requestResult field. This field is only present in the FaunaHTTPError sub class. If the error is not a FaunaHTTPError, then the console output is

Cannot read properties of undefined (reading 'responseRaw')

triggered here:

util.inspect(JSON.parse(error.faunaError.requestResult.responseRaw), {

and here:

util.inspect(JSON.parse(error.faunaError.requestResult.responseRaw), {

example

An example is in the event the client handles a timeout (rather than receiving a 503 http response). In that case, the js driver returns a TimeoutError.

other notes

The runQueries function always throws a QueryError object, so checking if error is a FaunaHTTPError will always return false here

if (error instanceof faunadb.errors.FaunaHTTPError) {

though error.faunaError could be.

Internal ticket number is FE-2671