Add custom errors with thiserror, log thread id

This commit is contained in:
2026-02-03 23:02:44 +02:00
parent 2e5568fccb
commit f84d812602
8 changed files with 126 additions and 58 deletions

View File

@@ -34,16 +34,22 @@
return day % 2 === 0 ? 1 : 2;
}
interface AppError {
kind: string;
details: string;
}
async function generate() {
let config = rota.toDTO();
console.log(config);
try {
let schedule = await invoke<MonthlyScheduleDTO>("generate", { config });
console.log("replyFromGenerate:", schedule);
console.log(schedule);
rota.solution = schedule;
} catch (error) {
console.error("Error:", error);
const { kind, details } = error as AppError;
console.error(`[${kind}] - ${details}`);
}
}
@@ -53,7 +59,8 @@
try {
await invoke("export", { schedule });
} catch (error) {
console.error("Error:", error);
const { kind, details } = error as AppError;
console.error(`[${kind}] - ${details}`);
}
}
</script>