diff --git a/src/json.hpp b/src/json.hpp
index b8ef5999..00e3fe24 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -5607,7 +5607,7 @@ class basic_json
             already-existing element if no insertion happened, and a bool
             denoting whether the insertion took place.
 
-    @throw std::domain_error when called on a type other than JSON object or
+    @throw type_error.311 when called on a type other than JSON object or
     null; example: `"cannot use emplace() with number"`
 
     @complexity Logarithmic in the size of the container, O(log(`size()`)).
@@ -5625,7 +5625,7 @@ class basic_json
         // emplace only works for null objects or arrays
         if (not(is_null() or is_object()))
         {
-            JSON_THROW(std::domain_error("cannot use emplace() with " + type_name()));
+            JSON_THROW(type_error(311, "cannot use emplace() with " + type_name()));
         }
 
         // transform null object into an object
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index 1026ad79..8de7e16f 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -5607,7 +5607,7 @@ class basic_json
             already-existing element if no insertion happened, and a bool
             denoting whether the insertion took place.
 
-    @throw std::domain_error when called on a type other than JSON object or
+    @throw type_error.311 when called on a type other than JSON object or
     null; example: `"cannot use emplace() with number"`
 
     @complexity Logarithmic in the size of the container, O(log(`size()`)).
@@ -5625,7 +5625,7 @@ class basic_json
         // emplace only works for null objects or arrays
         if (not(is_null() or is_object()))
         {
-            JSON_THROW(std::domain_error("cannot use emplace() with " + type_name()));
+            JSON_THROW(type_error(311, "cannot use emplace() with " + type_name()));
         }
 
         // transform null object into an object
diff --git a/test/src/unit-modifiers.cpp b/test/src/unit-modifiers.cpp
index c1a76909..ad055420 100644
--- a/test/src/unit-modifiers.cpp
+++ b/test/src/unit-modifiers.cpp
@@ -293,7 +293,7 @@ TEST_CASE("modifiers")
             json j = 1;
             CHECK_THROWS_AS(j.emplace_back("Hello"), json::type_error);
             CHECK_THROWS_WITH(j.emplace_back("Hello"),
-                "[json.exception.type_error.311] cannot use emplace_back() with number");
+                              "[json.exception.type_error.311] cannot use emplace_back() with number");
         }
     }
 
@@ -351,8 +351,9 @@ TEST_CASE("modifiers")
         SECTION("other type")
         {
             json j = 1;
-            CHECK_THROWS_AS(j.emplace("foo", "bar"), std::domain_error);
-            CHECK_THROWS_WITH(j.emplace("foo", "bar"), "cannot use emplace() with number");
+            CHECK_THROWS_AS(j.emplace("foo", "bar"), json::type_error);
+            CHECK_THROWS_WITH(j.emplace("foo", "bar"),
+                              "[json.exception.type_error.311] cannot use emplace() with number");
         }
     }