Merge branch 'toast-error-fallthrough' into 'main'

showAlertForError: fallthrough when response.error() fails

See merge request soapbox-pub/soapbox!3306
This commit is contained in:
Alex Gleason 2024-12-26 17:29:28 +00:00
commit baf1c2acae
1 changed files with 7 additions and 3 deletions

View File

@ -57,9 +57,13 @@ async function showAlertForError(networkError: HTTPError): Promise<void> {
return; return;
} }
const data = await response.error(); try {
if (data) { const data = await response.error();
return error(data.error); if (data) {
return error(data.error);
}
} catch {
// fallthrough
} }
const message = httpErrorMessages.find((httpError) => httpError.code === status)?.description; const message = httpErrorMessages.find((httpError) => httpError.code === status)?.description;