in the catch block, can't you just call console.error, end, done and then return?