show error messages in toaster

This commit is contained in:
Josh Hawkins 2025-10-23 08:15:55 -05:00
parent 33aae8c4e9
commit f78075b024
2 changed files with 17 additions and 3 deletions

View File

@ -300,12 +300,18 @@ export default function Step1NameCamera({
setTestResult(testResult); setTestResult(testResult);
toast.success(t("cameraWizard.step1.testSuccess")); toast.success(t("cameraWizard.step1.testSuccess"));
} else { } else {
const error = probeData?.stderr || "Unknown error"; const error =
Array.isArray(probeResponse.data?.[0]?.stderr) &&
probeResponse.data[0].stderr.length > 0
? probeResponse.data[0].stderr.join("\n")
: "Unable to probe stream";
setTestResult({ setTestResult({
success: false, success: false,
error: error, error: error,
}); });
toast.error(t("cameraWizard.commonErrors.testFailed", { error })); toast.error(t("cameraWizard.commonErrors.testFailed", { error }), {
duration: 6000,
});
} }
} catch (error) { } catch (error) {
const axiosError = error as { const axiosError = error as {
@ -323,6 +329,9 @@ export default function Step1NameCamera({
}); });
toast.error( toast.error(
t("cameraWizard.commonErrors.testFailed", { error: errorMessage }), t("cameraWizard.commonErrors.testFailed", { error: errorMessage }),
{
duration: 10000,
},
); );
} finally { } finally {
setIsTesting(false); setIsTesting(false);

View File

@ -66,8 +66,13 @@ export default function CameraManagementView({
return ( return (
<> <>
<Toaster
richColors
className="z-[1000]"
position="top-center"
closeButton
/>
<div className="flex size-full flex-col md:flex-row"> <div className="flex size-full flex-col md:flex-row">
<Toaster position="top-center" closeButton={true} />
<div className="scrollbar-container order-last mb-10 mt-2 flex h-full w-full flex-col overflow-y-auto pb-2 md:order-none"> <div className="scrollbar-container order-last mb-10 mt-2 flex h-full w-full flex-col overflow-y-auto pb-2 md:order-none">
{viewMode === "settings" ? ( {viewMode === "settings" ? (
<> <>