Skip to content

Commit

Permalink
Code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Mar 12, 2020
1 parent b3101e9 commit 77e255f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
19 changes: 2 additions & 17 deletions src/legacy/ui/public/notify/fatal_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,8 @@
*/

import { npSetup } from 'ui/new_platform';
import {
AngularHttpError,
formatAngularHttpError,
isAngularHttpError,
} from '../../../../plugins/kibana_legacy/public';

export function addFatalErrorCallback(callback: () => void) {
npSetup.core.fatalErrors.get$().subscribe(() => {
callback();
});
}
import { AngularHttpError, addFatalError } from '../../../../plugins/kibana_legacy/public';

export function fatalError(error: AngularHttpError | Error | string, location?: string) {
// add support for angular http errors to newPlatformFatalErrors
if (isAngularHttpError(error)) {
error = formatAngularHttpError(error);
}

npSetup.core.fatalErrors.add(error, location);
addFatalError(npSetup.core.fatalErrors, error, location);
}
2 changes: 1 addition & 1 deletion src/legacy/ui/public/notify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* under the License.
*/

export { fatalError, addFatalErrorCallback } from './fatal_error';
export { fatalError } from './fatal_error';
export { toastNotifications } from './toasts';
export { banners } from './banners';
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ import {
isAngularHttpError,
} from './format_angular_http_error';

export function addFatalErrorCallback(fatalErrors: FatalErrorsSetup, callback: () => void) {
fatalErrors.get$().subscribe(() => {
callback();
});
}

export function addFatalError(
fatalErrors: FatalErrorsSetup,
error: AngularHttpError | Error | string,
Expand Down

0 comments on commit 77e255f

Please sign in to comment.