If I want one of my js queries to fail, how do I properly go about that? If I trigger the query from another query and some failure condition exists, I want onFailure(error)
called.
If I throw an error it works, sort of: throw new Error('Whoops!')
But I cannot get the error message returned. I get a basically empty Error object. I would like to just send back something like:
{success: false, error: "You forgot something nimrod!"}
I tried various ways of calling Promise.reject()
assuming that the whole query was somehow wrapped in a promise, but either I assume wrong or I don't know how to do it.