Add error handler to broker.js, create utils.js