Good idea, thanks for sharing! Nice design also

hx-trigger in the response header would handle that cleanly. Fires an event client-side; one global handler shows the error.

Similar to wvbdmp's approach but without needing the extension