-
Couldn't load subscription status.
- Fork 109
Description
See this...
var queryObj = // A bad query object with a typo
try {
const cursor = await this.db.query(queryObj);
const results = await cursor.all();
return results; //returns as {} instead of throwing error
} catch (e) {
console.error('There was an issue finding items with the AQL query ', queryObj)
throw e;
}
The error never gets caught because I never see my console.error message. Instead what I see is this totally disconnected console.error in my logs:
ArangoError: AQL: collection not found: c (while parsing)
at new ArangoError (/projects/opensource/jollofjs/packages/jollof-data-arangodb/node_modules/arangojs/lib/async/error.js:67:21)
at Object.resolve (/projects/opensource/jollofjs/packages/jollof-data-arangodb/node_modules/arangojs/lib/async/connection.js:224:24)
at _hosts.(anonymous function) (/projects/opensource/jollofjs/packages/jollof-data-arangodb/node_modules/arangojs/lib/async/connection.js:97:26)
at IncomingMessage.res.on (/projects/opensource/jollofjs/packages/jollof-data-arangodb/node_modules/arangojs/lib/async/util/request.node.js:44:17)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1045:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
There is no trace of my source code in this error to know exactly where this error is coming from.
This means the query functions in the module do not actually throw any ArangoErrors in such a way that is catchable by blocks up the stack.
query(...) returns an empty object even if an error happened and doesn't throw the ArangoError so one cannot even ascertain which query failed?
This is a very bad approach to error handling.
How have others been using this without having unstable apps?