diff --git a/apps/central-scan/frontend/src/screens/admin_actions_screen.tsx b/apps/central-scan/frontend/src/screens/admin_actions_screen.tsx index 9c2c19a694b..c8b35b3301e 100644 --- a/apps/central-scan/frontend/src/screens/admin_actions_screen.tsx +++ b/apps/central-scan/frontend/src/screens/admin_actions_screen.tsx @@ -96,6 +96,7 @@ export function AdminActionsScreen({ function saveBackup() { setIsBackingUp(true); + setBackupError(''); exportCastVoteRecordsToUsbDriveMutation.mutate( { isMinimalExport: false }, { diff --git a/libs/backend/src/cast_vote_records/export.ts b/libs/backend/src/cast_vote_records/export.ts index 08e3cece62d..96e5902d706 100644 --- a/libs/backend/src/cast_vote_records/export.ts +++ b/libs/backend/src/cast_vote_records/export.ts @@ -13,6 +13,7 @@ import { import { assert, assertDefined, + err, ok, Result, throwIllegalValue, @@ -673,7 +674,9 @@ export async function exportCastVoteRecordsToUsbDrive( ? usbDriveStatus.mountPoint : undefined; } - assert(usbMountPoint !== undefined); + if (usbMountPoint === undefined) { + return err({ type: 'missing-usb-drive' }); + } const exportContext: ExportContext = { exporter: new Exporter({ allowedExportPatterns: SCAN_ALLOWED_EXPORT_PATTERNS,