debian-mirror-gitlab/app/assets/javascripts/snippets/utils/error.js
2021-03-11 19:13:27 +05:30

15 lines
310 B
JavaScript

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;
};