mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
16 lines
370 B
TypeScript
16 lines
370 B
TypeScript
import { Error } from 'App/State/AppSectionState';
|
|
|
|
function getErrorMessage(xhr: Error, fallbackErrorMessage?: string) {
|
|
if (!xhr || !xhr.responseJSON) {
|
|
return fallbackErrorMessage;
|
|
}
|
|
|
|
if ('message' in xhr.responseJSON && xhr.responseJSON.message) {
|
|
return xhr.responseJSON.message;
|
|
}
|
|
|
|
return fallbackErrorMessage;
|
|
}
|
|
|
|
export default getErrorMessage;
|