When an http request issued by HTMX fails, the error message is inserted into a special element at the top of the document's <body>
.
Include the extension:
<head>
...
<script src="https://unpkg.com/htmx-extension-error-drawer@^1/src/error-drawer.js" defer></script>
...
</head>
Enable the extension:
<body hx-ext="error-drawer" >
...
</body>
Create your own #error-drawer
element elsewhere in the page if you don't want it at the top of <body>
.