import log from "./log" ; export default function handleCommandHandlerErrors < T extends Function > ( commandHandler ) { if ( process . env . NODE_ENV === "test" ) { return commandHandler ; } return async function commandHandlerWrapper ( this ) { try { return await commandHandler . apply ( this , arguments ) ; } catch ( err ) { log . error ( err . message ) ; process . exit ( 1 ) ; } } as any ; }