From 5967b606c7f399bd66de7c06d096ec471800e308 Mon Sep 17 00:00:00 2001 From: Brett Williams Date: Sun, 30 Aug 2026 22:41:59 -0500 Subject: [PATCH] Fix modal never dismissing and noisy 404 errors The .modal CSS display:flex override the hidden attribute, so the empty job modal was always visible on load and closeModal() could not hide it - the 'non-dismissable empty error'. Add .modal[hidden] { display:none } so the hidden attribute wins. The blanket errorhandler(Exception) also converted normal HTTP 404s (e.g. /favicon.ico, /apple-touch-icon-*.png requested by the browser) into 500s, flooding the log. Return HTTPException instances unchanged so only genuine 500s are logged as errors. --- ctrl/app.py | 3 +++ ctrl/static/style.css | 1 + 2 files changed, 4 insertions(+) diff --git a/ctrl/app.py b/ctrl/app.py index 58c7c13..d16e1d9 100644 --- a/ctrl/app.py +++ b/ctrl/app.py @@ -5,6 +5,7 @@ import os import queue from flask import Flask, jsonify, request, send_from_directory, Response +from werkzeug.exceptions import HTTPException import ctrl.db as db import ctrl.settings as settings @@ -150,6 +151,8 @@ def api_stream(job_id): @app.errorhandler(Exception) def _handle_error(err): + if isinstance(err, HTTPException): + return err log.exception("Unhandled error serving %s %s", request.method, request.path) return jsonify({"error": f"{type(err).__name__}: {err}"}), 500 diff --git a/ctrl/static/style.css b/ctrl/static/style.css index 67d905e..d4a876e 100644 --- a/ctrl/static/style.css +++ b/ctrl/static/style.css @@ -93,6 +93,7 @@ button:hover { filter: brightness(1.1); } .badge.queued, .badge.dispatching, .badge.building { background: #1c2a40; color: var(--accent); } .badge.cancelled { background: var(--panel-2); color: var(--muted); } +.modal[hidden] { display: none; } .modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);