PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: pallets/werkzeug (python)

Issue:
Add "421 Misdirected Request" http exception
Related: #1256 

Any concerns against adding a http exception class for this status code?

Right now aborting fails with a `LookupError: no exception for <HTTPStatus.MISDIRECTED_REQUEST: 421>` error if you try

```
abort(http.HTTPStatus.MISDIRECTED_REQUEST)
```

The `Aborter` class can be enriched to feature extra status codes and the `Response` class can be used to return arbitrary status codes and messages. But wouldn't it make sense that this http exception was featured out of the box?

Pull request:
Adding 421 Misdirected Request HTTP Exception
Adding `MisdirectedRequest` error Class.


fixes #2850 


Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 320e4836..e6f54115 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -9,6 +9,7 @@ Unreleased
 -   ``CacheControl.no_transform`` is a boolean when present. ``min_fresh`` is
     ``None`` when not present. Added the ``must_understand`` attribute. Fixed
     some typing issues on cache control. :issue:`2881`
+-   Add 421 ``MisdirectedRequest`` HTTP exception. :issue:`2850`
 
 
 Version 3.0.6
diff --git a/docs/exceptions.rst b/docs/exceptions.rst
index 88a309d4..d5b6970b 100644
--- a/docs/exceptions.rst
+++ b/docs/exceptions.rst
@@ -44,6 +44,8 @@ The following error classes exist in Werkzeug:
 
 .. autoexception:: ImATeapot
 
+.. autoexception:: MisdirectedRequest
+
 .. autoexception:: UnprocessableEntity
 
 .. autoexception:: Locked
diff --git a/src/werkzeug/exceptions.py b/src/werkzeug/exceptions.py
index 6ce7ef95..02af2c15 100644
--- a/src/werkzeug/exceptions.py
+++ b/src/werkzeug/exceptions.py
@@ -571,6 +571,17 @@ class ImATeapot(HTTPException):
     description = "This server is a teapot, not a coffee machine"
 
 
+class MisdirectedRequest(HTTPException):
+    """421 Misdirected Request
+
+    Indicates that the request was directed to a server that is not able to
+    produce a response.
+    """
+
+    code = 421
+    description = "The server is not able to produce a response."
+
+
 class UnprocessableEntity(HTTPException):
     """*422* `Unprocessable Entity`
 


Test patch:
diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py
index ad20b3f8..67d76d2b 100644
--- a/tests/test_exceptions.py
+++ b/tests/test_exceptions.py
@@ -37,6 +37,7 @@ def test_proxy_exception():
         (exceptions.RequestEntityTooLarge, 413),
         (exceptions.RequestURITooLarge, 414),
         (exceptions.UnsupportedMediaType, 415),
+        (exceptions.MisdirectedRequest, 421),
         (exceptions.UnprocessableEntity, 422),
         (exceptions.Locked, 423),
         (exceptions.InternalServerError, 500),