Files
2024-02-15 17:01:50 +00:00

17 lines
356 B
TypeScript

import type {ResponseMeta} from 'sentry/api';
export default function parseApiError(resp: ResponseMeta): string {
const {detail} = resp?.responseJSON || ({} as object);
// return immediately if string
if (typeof detail === 'string') {
return detail;
}
if (detail?.message) {
return detail.message;
}
return 'Unknown API Error';
}