UNPKG

kibana-123

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

30 lines (22 loc) 778 B
import Notifier from 'ui/notify/notifier'; import ErrorHandlersProvider from '../../_error_handlers'; export default function RequestErrorHandlerFactory(Private) { const errHandlers = Private(ErrorHandlersProvider); const notify = new Notifier({ location: 'Courier Fetch Error' }); function handleError(req, error) { const myHandlers = []; errHandlers.splice(0).forEach(function (handler) { (handler.source === req.source ? myHandlers : errHandlers).push(handler); }); if (!myHandlers.length) { notify.fatal(new Error(`unhandled courier request error: ${ notify.describeError(error) }`)); } else { myHandlers.forEach(function (handler) { handler.defer.resolve(error); }); } } return handleError; };