fix the failures that were failing quietly
This commit is contained in:
+13
-4
@@ -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>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
void (async () => {
|
||||
await refresh()
|
||||
win.onMoved(refresh).then(fn => { if (mounted) unlisten.push(fn) })
|
||||
.catch(e => console.warn("could not watch the picker window position:", e))
|
||||
let hoverDebounce = 0
|
||||
listen<Rect>("picker-hover", (e) => {
|
||||
clearTimeout(hoverDebounce)
|
||||
|
||||
+11
-3
@@ -62,6 +62,10 @@
|
||||
try { diagnostics = await api.diagnosticsInfo() } catch { diagnostics = null }
|
||||
}
|
||||
|
||||
function openLogFolder() {
|
||||
void api.openLogDir().catch(e => console.warn("could not open the log folder:", e))
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (!cfg) return
|
||||
|
||||
@@ -94,8 +98,12 @@
|
||||
|
||||
async function pickOutputDir() {
|
||||
if (!cfg) return
|
||||
const picked = await open({ directory: true, defaultPath: cfg.output_dir ?? undefined })
|
||||
if (typeof picked === "string") cfg.output_dir = picked
|
||||
try {
|
||||
const picked = await open({ directory: true, defaultPath: cfg.output_dir ?? undefined })
|
||||
if (typeof picked === "string") cfg.output_dir = picked
|
||||
} catch (e) {
|
||||
console.warn("directory picker failed:", e)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -288,7 +296,7 @@
|
||||
<div class="diag-row">
|
||||
<span class="field-label">Log folder</span>
|
||||
<span class="diag-val mono">{diagnostics ? diagnostics.log_dir : "..."}</span>
|
||||
<button class="btn-ghost compact" onclick={() => api.openLogDir()} disabled={!diagnostics}>Open</button>
|
||||
<button class="btn-ghost compact" onclick={openLogFolder} disabled={!diagnostics}>Open</button>
|
||||
</div>
|
||||
<div class="diag-tail-wrap">
|
||||
<div class="diag-tail-head">
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
})
|
||||
|
||||
function dismiss() { info = null; errMsg = null; phase = "info" }
|
||||
function viewRelease() { if (info) void api.openUrl(info.release_url) }
|
||||
function viewRelease() {
|
||||
if (!info) return
|
||||
void api.openUrl(info.release_url).catch(e => { errMsg = String(e); phase = "error" })
|
||||
}
|
||||
|
||||
async function download() {
|
||||
if (!info?.download_url) { errMsg = "no downloadable exe in this release"; phase = "error"; return }
|
||||
|
||||
Reference in New Issue
Block a user