web: improve attachment errors on upload/download

This commit is contained in:
Abdullah Atta
2025-09-13 13:11:35 +05:00
parent cf169eb6d6
commit 152a59fe26

View File

@@ -739,6 +739,11 @@ function parseS3Error(data: ArrayBuffer | unknown) {
? new TextDecoder().decode(data) ? new TextDecoder().decode(data)
: typeof data === "string" : typeof data === "string"
? data ? data
: typeof data === "object" &&
data &&
"error" in data &&
typeof data.error === "string"
? data.error
: null; : null;
const error = { const error = {
@@ -780,9 +785,10 @@ function toS3Error(e: unknown): S3Error {
} }
function showError(error: S3Error, message?: string) { function showError(error: S3Error, message?: string) {
message = `${message ? message + " " : ""}${error.Message}`;
showToast( showToast(
"error", "error",
`[${error.Code}] ${message ? message + " " : ""}${error.Message}` error.Code === "UNKNOWN" ? message : `[${error.Code}] ${message}`
); );
} }