fix the failures that were failing quietly

This commit is contained in:
2026-09-21 06:22:44 +03:00
parent 371c910068
commit b33ce5bf77
8 changed files with 110 additions and 35 deletions
+13 -4
View File
@@ -202,6 +202,12 @@
// ---- Actions ----
// Several template handlers fire a command without awaiting it; an unhandled
// rejection there would disappear without a trace.
function toastOnFail(p: Promise<unknown>) {
void p.catch((e) => { errMsg = String(e) })
}
async function toggleFrame() {
useFrame = !useFrame
try {
@@ -418,6 +424,7 @@
const f = format
if (phase !== "editing" || pathOverridden || !f) return
void api.defaultOutputPath(f).then(p => { if (!pathOverridden) outputPath = p })
.catch(e => console.warn("could not resolve the default output path:", e))
})
// Auto-dismiss error toast
@@ -528,15 +535,15 @@
{#each PRESETS as [w, h, label]}
<button class="chip" onclick={() => {
aspectLock = w / h
api.setOverlayAspect(aspectLock)
toastOnFail(api.setOverlayAspect(aspectLock))
emit("overlay-set-ratio", { ratio: aspectLock })
api.setOverlaySize(w, h)
toastOnFail(api.setOverlaySize(w, h))
}}>{label}</button>
{/each}
{#if aspectLock !== null}
<button class="chip unlock" onclick={() => {
aspectLock = null
api.setOverlayAspect(null)
toastOnFail(api.setOverlayAspect(null))
emit("overlay-set-ratio", { ratio: null })
}}>Unlock</button>
{/if}
@@ -712,7 +719,9 @@
<p class="done-path mono">{exportResult.output_path}</p>
<div class="done-actions">
<button class="btn-primary" onclick={startOver}>Record another</button>
<button class="btn-ghost" onclick={() => exportResult && api.revealInExplorer(exportResult.output_path)}>
<button class="btn-ghost" onclick={() => {
if (exportResult) toastOnFail(api.revealInExplorer(exportResult.output_path))
}}>
Show in explorer
</button>
</div>