fix: surface AbleSign screen creation errors instead of swallowing

Previously caught and silently ignored. Now shows error message on
the screens page so we can debug the pairing flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mitchell R 2026-05-27 02:41:13 +02:00
parent 10f5cf7fac
commit 01fcb66402

View file

@ -144,8 +144,12 @@ export function registerAbleSignRoutes(app: H3, deps: AdminDeps): void {
await deps.repo.updateAbleSignAccount(accountId, { await deps.repo.updateAbleSignAccount(accountId, {
screen_count: (account.screen_count ?? 0) + 1, screen_count: (account.screen_count ?? 0) + 1,
}); });
} catch { } catch (err) {
// redirect back — error handling TODO const msg = (err as Error).message ?? "unknown error";
event.context.obs?.log.warn("ablesign screen creation failed: {msg}", { msg });
const screens = await deps.repo.listAbleSignScreens(accountId);
for (const s of screens) (s as any).has_entity = !!(await deps.repo.getEntityByAbleSignScreen(s.id));
return htmlPage(AbleSignScreensPage({ screens, accountId, error: `Screen creation failed: ${msg}` }));
} }
return new Response(null, { status: 302, headers: { location: "/admin/ablesign/screens" } }); return new Response(null, { status: 302, headers: { location: "/admin/ablesign/screens" } });