1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-03-05 13:20:20 -05:00
Files
Sonarr/frontend/src/Utilities/Object/getErrorMessage.ts
2024-11-26 17:37:21 -08:00

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;