Error propagation in `call` routes
In our scaffolding library (https://github.com/ParabolInc/falcor-saddle), we create a call route for record creation using a set of promises, a createPromise and a getLengthPromise. In our unit tests createPromise is purposefully throwing an error. This error seems to be incorrectly propagated up to Falcor and back to the client; it actually causes falcor-http-datasource to throw Error: {"throwToNext":true}.
const createPromise = async function (params) {
throw new Error('PromiseError');
}
export function createCallCreateRoute(routeBasename, acceptedKeys,
createPromise, getLengthPromise,
modelIdGetter = defModelIdGetter) {
const routeByIdBasename = routeBasename + routeSuffixById;
return {
route: routeBasename + '.' + routeSuffixCreate,
async call(callPath, args) {
const objParams = _.pick(args[0], acceptedKeys);
try {
const newObj = await createPromise(objParams);
const newLength = await getLengthPromise();
return [
jsonGraph.pathValue(
[routeBasename, newLength - 1],
jsonGraph.ref([ routeByIdBasename, modelIdGetter(newObj) ])
),
jsonGraph.pathValue([ routeBasename, routeSuffixLength ], newLength)
];
} catch (err) {
throw new Error(err);
}
}
};
}
The PromiseError is correctly propagated from the call function (after the catch), but it does not reach the client.
Is there any progress regarding this issue? Should it behaves like get/set and should it be catch by the errorSelector callback on the model?
I actually hit the same issue where the error is not propagated to the client.