Skip to content

Commit 07deb3e

Browse files
committed
fix: error responses were passed as resolved instead of catched if no errorHandler option was passed, also errorHandler was never passed to the client-side api
1 parent 688b996 commit 07deb3e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/module.js

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ module.exports = function NeoModule(moduleOptions) {
7676
options: {
7777
apiHandlerFile: moduleOptions.clientSideApiHandler,
7878
successHandlerFile: moduleOptions.successHandler,
79+
errorHandlerFile: moduleOptions.errorHandler,
7980
controllers: JSON.stringify(controllerMappingClientSide(moduleOptions.directory)),
8081
apiConfig: JSON.stringify(moduleOptions)
8182
}

lib/plugins/api.template.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ function runSuccessHandler(result) {
2626
/**
2727
* Runs possible error handler
2828
*
29-
* @param result
29+
* @param error
3030
* @returns {Function}
3131
*/
32-
function runErrorHandler(result) {
33-
return ErrorHandler && ErrorHandler(result) || Promise.resolve(result);
32+
function runErrorHandler(error) {
33+
return ErrorHandler && ErrorHandler(error) || Promise.catch(error);
3434
}
3535

3636
/**

0 commit comments

Comments
 (0)