-
-
Notifications
You must be signed in to change notification settings - Fork 798
Schema resolvers not gracefully handling errors thrown inside resolve function #2534
Copy link
Copy link
Closed
Description
Steps to reproduce
When creating a schema resolver, if an error is thrown it it does not gracefully handle it. Instead it returns the error caused by the code in resolver.js:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'join')
at Resolver.resolve (C:\Users\Joe\projects\mrp\node_modules\@feathersjs\schema\lib\resolver.js:58:133)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async C:\Users\Joe\projects\mrp\node_modules\@feathersjs\schema\lib\hooks.js:65:26
at async runMethod (C:\Users\Joe\projects\mrp\node_modules\@feathersjs\transport-commons\lib\socket\utils.js:86:29)
Here is a simple test case that its failing for me:
import { schema, resolve } from '@feathersjs/schema';
const populate = resolve({
properties: {
user: async (value, message, context) => {
throw new Error('Test Error');
}
}
});
export default {
after: {
get: [asRegularHook(resolveResult(schema.populate))],
},
};
Expected behavior
Should return the error that is thrown.
Actual behavior
Resolver errors out due to bug in the schema\lib\resolver.js. It is trying to access status.properties.join() but status.properties does not exist. That error then is returned to the client, instead of the actual error.
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
Feathers: 5.0.0-pre.15
NodeJS version:
16.X
Operating System:
Windows 10
Browser Version:
Version 1.34.80
React Native Version:
N/A
Module Loader:
Webpack
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels