diff --git a/tornadowebapi/exceptions.py b/tornadowebapi/exceptions.py
index a5f3dd3..a2999b5 100644
--- a/tornadowebapi/exceptions.py
+++ b/tornadowebapi/exceptions.py
@@ -44,7 +44,7 @@ class NotFound(WebAPIException):
         return None
 
 
-class BadRequest(WebAPIException):
+class BadRepresentation(WebAPIException):
     """Exception raised when the resource representation is
     invalid or does not contain the appropriate keys.
     Raise this exception in your handlers when the received
@@ -53,6 +53,10 @@ class BadRequest(WebAPIException):
     http_code = httpstatus.BAD_REQUEST
 
 
+# Deprecated. Kept for compatibility
+BadRequest = BadRepresentation
+
+
 class Unable(WebAPIException):
     """Exception raised when the request cannot be performed
     for whatever reason that is not dependent on the client.
diff --git a/tox.ini b/tox.ini
index 1147235..debc066 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,2 +1,2 @@
 [flake8]
-exclude = build/*,venv/*,doc/source/conf.py
+exclude = build/*,venv*/*,doc/source/conf.py

Change BadRequest error to BadRepresentation
BadRequest is HTTP. It's technically a bad representation that the CRUD methods handle, and the exception should reflect that.

Migrated from https://github.com/simphony/simphony-remote/issues/181
diff --git a/tornadowebapi/tests/test_webapi.py b/tornadowebapi/tests/test_webapi.py
index 3a3c8e5..e3f3b8b 100644
--- a/tornadowebapi/tests/test_webapi.py
+++ b/tornadowebapi/tests/test_webapi.py
@@ -74,19 +74,19 @@ class UnsupportAll(Resource):
 class Unprocessable(Resource):
     @gen.coroutine
     def create(self, representation):
-        raise exceptions.BadRequest("unprocessable", foo="bar")
+        raise exceptions.BadRepresentation("unprocessable", foo="bar")
 
     @gen.coroutine
     def update(self, identifier, representation):
-        raise exceptions.BadRequest("unprocessable", foo="bar")
+        raise exceptions.BadRepresentation("unprocessable", foo="bar")
 
     @gen.coroutine
     def retrieve(self, identifier):
-        raise exceptions.BadRequest("unprocessable", foo="bar")
+        raise exceptions.BadRepresentation("unprocessable", foo="bar")
 
     @gen.coroutine
     def items(self):
-        raise exceptions.BadRequest("unprocessable", foo="bar")
+        raise exceptions.BadRepresentation("unprocessable", foo="bar")
 
 
 class UnsupportsCollection(Resource):
@@ -328,7 +328,7 @@ class TestREST(AsyncHTTPTestCase):
         self.assertEqual(res.code, httpstatus.BAD_REQUEST)
         self.assertEqual(res.headers["Content-Type"], 'application/json')
         self.assertEqual(escape.json_decode(res.body), {
-            "type": "BadRequest",
+            "type": "BadRepresentation",
             "message": "unprocessable",
             "foo": "bar",
         })
@@ -340,7 +340,7 @@ class TestREST(AsyncHTTPTestCase):
         self.assertEqual(res.code, httpstatus.BAD_REQUEST)
         self.assertEqual(res.headers["Content-Type"], 'application/json')
         self.assertEqual(escape.json_decode(res.body), {
-            "type": "BadRequest",
+            "type": "BadRepresentation",
             "message": "unprocessable",
             "foo": "bar",
         })
@@ -353,7 +353,7 @@ class TestREST(AsyncHTTPTestCase):
         self.assertEqual(res.code, httpstatus.BAD_REQUEST)
         self.assertEqual(res.headers["Content-Type"], 'application/json')
         self.assertEqual(escape.json_decode(res.body), {
-            "type": "BadRequest",
+            "type": "BadRepresentation",
             "message": "unprocessable",
             "foo": "bar",
         })
@@ -365,7 +365,7 @@ class TestREST(AsyncHTTPTestCase):
         self.assertEqual(res.code, httpstatus.BAD_REQUEST)
         self.assertEqual(res.headers["Content-Type"], 'application/json')
         self.assertEqual(escape.json_decode(res.body), {
-            "type": "BadRequest",
+            "type": "BadRepresentation",
             "message": "unprocessable",
             "foo": "bar",
         })
@@ -378,7 +378,7 @@ class TestREST(AsyncHTTPTestCase):
         self.assertEqual(res.code, httpstatus.BAD_REQUEST)
         self.assertEqual(res.headers["Content-Type"], 'application/json')
         self.assertEqual(escape.json_decode(res.body), {
-            "type": "BadRequest",
+            "type": "BadRepresentation",
             "message": "unprocessable",
             "foo": "bar",
         })

pip install -e .[dev]
parse_log_pytest
requirements.txt
flake8 coverage pytest
apt-get update apt-get install -y gcc
3.9
requirements.txt dev-requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
coverage==7.8.0
exceptiongroup==1.2.2
flake8==7.2.0
iniconfig==2.1.0
mccabe==0.7.0
packaging==24.2
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.1
pytest==8.3.5
tomli==2.2.1
tornado==6.4.2
-e git+https://github.com/simphony/tornado-webapi.git@95ad403cd70109fb94727a119545567593d8203d#egg=tornadowebapi

name: tornado-webapi
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - iniconfig==2.1.0
      - mccabe==0.7.0
      - packaging==24.2
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.1
      - pytest==8.3.5
      - tomli==2.2.1
      - tornado==6.4.2
prefix: /opt/conda/envs/tornado-webapi

tornadowebapi/tests/test_webapi.py::TestREST::test_unprocessable
tornadowebapi/tests/test_webapi.py::TestREST::test_broken tornadowebapi/tests/test_webapi.py::TestREST::test_create tornadowebapi/tests/test_webapi.py::TestREST::test_delete tornadowebapi/tests/test_webapi.py::TestREST::test_items tornadowebapi/tests/test_webapi.py::TestREST::test_post_non_json tornadowebapi/tests/test_webapi.py::TestREST::test_post_on_resource tornadowebapi/tests/test_webapi.py::TestREST::test_retrieve tornadowebapi/tests/test_webapi.py::TestREST::test_unexistent_resource_type tornadowebapi/tests/test_webapi.py::TestREST::test_unsupported_methods tornadowebapi/tests/test_webapi.py::TestREST::test_unsupports_collections tornadowebapi/tests/test_webapi.py::TestREST::test_update tornadowebapi/tests/test_webapi.py::TestRESTFunctions::test_api_handlers tornadowebapi/tests/test_webapi.py::TestNonGlobalRegistry::test_non_global_registry
tox.ini tornadowebapi/exceptions.py
tox.ini tornadowebapi/exceptions.py