mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* Chore: updates getMessageFromError return type * Chore: updates the position of incorrectly placed bang operator * Chore: updates typing on dropdown typeahead directive * Chore: updates QueryOperationAction props to require title * Revert "Chore: updates QueryOperationAction props to require title"
18 lines
438 B
TypeScript
18 lines
438 B
TypeScript
import _ from 'lodash';
|
|
|
|
export function getMessageFromError(err: string | (Error & { data?: any; statusText?: string })): string {
|
|
if (err && !_.isString(err)) {
|
|
if (err.message) {
|
|
return err.message;
|
|
} else if (err.data && err.data.message) {
|
|
return err.data.message;
|
|
} else if (err.statusText) {
|
|
return err.statusText;
|
|
} else {
|
|
return JSON.stringify(err);
|
|
}
|
|
}
|
|
|
|
return err as string;
|
|
}
|