export function wrapErrorHandler ( handler , error ) { let returnValue ; try { returnValue = handler ( error ) ; } catch ( error ) { console . log ( 'FATAL: Error occurred in "error" event handler' ) ; console . log ( error ) ; } if ( returnValue && returnValue . catch ) { returnValue . catch ( ( error ) => { console . log ( 'FATAL: Error occurred in "error" event handler' ) ; console . log ( error ) ; } ) ; } }