fix: showing errors when converting qr code

This commit is contained in:
trafficlunar 2025-04-12 14:44:36 +01:00
parent 5eab64ef96
commit 38356cf2f9
2 changed files with 3 additions and 2 deletions

View file

@ -101,7 +101,7 @@ export default function SubmitForm() {
try { try {
conversion = convertQrCode(qrBytes); conversion = convertQrCode(qrBytes);
} catch (error) { } catch (error) {
setError(error as string); setError(error instanceof Error ? error.message : String(error));
return; return;
} }

View file

@ -40,7 +40,8 @@ export function convertQrCode(bytes: Uint8Array): { mii: Mii; tomodachiLifeMii:
} }
return { mii, tomodachiLifeMii }; return { mii, tomodachiLifeMii };
} catch { } catch (error) {
console.error(error);
throw new Error("Mii data is not valid"); throw new Error("Mii data is not valid");
} }
} }