hooks.js
function postHookErrorHandler(err) {
                    /**
                     * Helper to add an error to an Object "errors" Symbol
                     */
                    const addError = (obj) => {
                        obj[ERR_KEY] = obj[ERR_KEY] || [];
                        obj[ERR_KEY].push(err);
                        return obj;
                    };

                    /**
                     * For response type that are *not* objects (string, integers, functions...)
                     * we convert the response to an object with a "result" property and set it as "override"
                     */
                    if (typeof response !== 'object') {
                        response = {
                            __override: {
                                result: response,
                            },
                        };
                    }

                    if ({}.hasOwnProperty.call(response, '__override')) {
                        response.__override = addError(response.__override);
                    } else {
                        response = addError(response);
                    }

                    return nextPostHook(response);
                }
function postHookErrorHandler(err) {
                    /**
                     * Helper to add an error to an Object "errors" Symbol
                     */
                    const addError = (obj) => {
                        obj[ERR_KEY] = obj[ERR_KEY] || [];
                        obj[ERR_KEY].push(err);
                        return obj;
                    };

                    /**
                     * For response type that are *not* objects (string, integers, functions...)
                     * we convert the response to an object with a "result" property and set it as "override"
                     */
                    if (typeof response !== 'object') {
                        response = {
                            __override: {
                                result: response,
                            },
                        };
                    }

                    if ({}.hasOwnProperty.call(response, '__override')) {
                        response.__override = addError(response.__override);
                    } else {
                        response = addError(response);
                    }

                    return nextPostHook(response);
                }
function postHookErrorHandler ( err ) { /**
                     * Helper to add an error to an Object "errors" Symbol
                     */ const addError = ( obj ) => { obj [ ERR_KEY ] = obj [ ERR_KEY ] || [ ] ; obj [ ERR_KEY ] . push ( err ) ; return obj ; } ; /**
                     * For response type that are *not* objects (string, integers, functions...)
                     * we convert the response to an object with a "result" property and set it as "override"
                     */ if ( typeof response !== 'object' ) { response = { __override : { result : response , } , } ; } if ( { } . hasOwnProperty . call ( response , '__override' ) ) { response . __override = addError ( response . __override ) ; } else { response = addError ( response ) ; } return nextPostHook ( response ) ; }
"post" hook Error handling
@param {*} err the error returned by latest "post" hook
post hook Error handling