UNPKG

@spalger/kibana

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

28 lines (22 loc) 742 B
define(function (require) { return function RequestErrorHandlerFactory(Private, Notifier) { var errHandlers = Private(require('ui/courier/_error_handlers')); var notify = new Notifier({ location: 'Courier Fetch Error' }); function handleError(req, error) { var myHandlers = []; errHandlers.splice(0).forEach(function (handler) { (handler.source === req.source ? myHandlers : errHandlers).push(handler); }); if (!myHandlers.length) { notify.fatal(new Error('unhandled error ' + (error.stack || error.message))); } else { myHandlers.forEach(function (handler) { handler.defer.resolve(error); }); } } return handleError; }; });