diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6a2adf2..224af41a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
Version 61:
* Remove Spirit dependency
+* Use generic_cateogry for errno
--------------------------------------------------------------------------------
diff --git a/doc/quickref.xml b/doc/quickref.xml
index 3216d575..2ac0fa58 100644
--- a/doc/quickref.xml
+++ b/doc/quickref.xml
@@ -196,6 +196,7 @@
buffer_cat
buffer_prefix
buffers
+ generic_category
iequals
ostream
read_size
diff --git a/example/server-framework/file_body.hpp b/example/server-framework/file_body.hpp
index 526d9c78..345a1fa2 100644
--- a/example/server-framework/file_body.hpp
+++ b/example/server-framework/file_body.hpp
@@ -180,8 +180,8 @@ init(beast::error_code& ec)
if(! file_)
{
// Convert the old-school `errno` into
- // an error code using the system category.
- ec = beast::error_code{errno, beast::system_category()};
+ // an error code using the generic category.
+ ec = beast::error_code{errno, beast::generic_category()};
return;
}
@@ -219,8 +219,9 @@ get(beast::error_code& ec) ->
// Handle any errors
if(ferror(file_))
{
- // Convert old-school `errno` to error_code
- ec = beast::error_code(errno, beast::system_category());
+ // Convert the old-school `errno` into
+ // an error code using the generic category.
+ ec = beast::error_code{errno, beast::generic_category()};
return boost::none;
}
@@ -350,8 +351,8 @@ init(boost::optional const& content_length, beast::error_code& ec
if(! file_)
{
// Convert the old-school `errno` into
- // an error code using the system category.
- ec = beast::error_code{errno, beast::system_category()};
+ // an error code using the generic category.
+ ec = beast::error_code{errno, beast::generic_category()};
return;
}
@@ -379,8 +380,9 @@ put(ConstBufferSequence const& buffers, beast::error_code& ec)
// Handle any errors
if(ferror(file_))
{
- // Convert old-school `errno` to error_code
- ec = beast::error_code(errno, beast::system_category());
+ // Convert the old-school `errno` into
+ // an error code using the generic category.
+ ec = beast::error_code{errno, beast::generic_category()};
return;
}
}
diff --git a/include/beast/core/error.hpp b/include/beast/core/error.hpp
index 0b9b667e..f98f6d7a 100644
--- a/include/beast/core/error.hpp
+++ b/include/beast/core/error.hpp
@@ -23,6 +23,14 @@ using system_error = boost::system::system_error;
/// The type of error category used by the library
using error_category = boost::system::error_category;
+/// A function to return the generic error category used by the library
+#if BEAST_DOXYGEN
+error_category const&
+generic_category();
+#else
+using boost::system::generic_category;
+#endif
+
/// A function to return the system error category used by the library
#if BEAST_DOXYGEN
error_category const&