Handle unexpected exceptions better
This commit is contained in:
@ -62,9 +62,16 @@ export default function (props: AppealCardProps) {
|
||||
|
||||
document.getElementById(`appeal_${props.id}`)?.remove();
|
||||
} else {
|
||||
let error;
|
||||
|
||||
try {
|
||||
error = ((await actionReq.json()) as { error: string }).error;
|
||||
} catch {
|
||||
error = "Unknown error";
|
||||
}
|
||||
setLoading(false);
|
||||
toast({
|
||||
description: ((await actionReq.json()) as { error: string }).error,
|
||||
description: error,
|
||||
duration: 10000,
|
||||
status: "error",
|
||||
title: "Oops!",
|
||||
|
Reference in New Issue
Block a user