debian-mirror-gitlab/app/assets/javascripts/snippets/utils/error.js

16 lines
310 B
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import { isString } from 'lodash';
import { __ } from '~/locale';
export const UNEXPECTED_ERROR = __('Unexpected error');
export const getErrorMessage = (e) => {
if (!e) {
return UNEXPECTED_ERROR;
}
if (isString(e)) {
return e;
}
return e.message || e.networkError || UNEXPECTED_ERROR;
};