Skip to content

Commit

Permalink
Fix error message on lemm.ee image upload (aeharding#1586)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding authored Aug 13, 2024
1 parent 3a25bf5 commit 7e36446
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/lemmy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export async function _uploadImage(client: LemmyHttp, image: File) {
image: compressedImageIfNeeded as File,
});

if (!response.url) throw new Error(response.msg);
// lemm.ee uses response.message for error messages (e.g. account too new)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (!response.url) throw new Error(response.msg ?? (response as any).message);

return response;
}
Expand Down

0 comments on commit 7e36446

Please sign in to comment.