diff --git a/doc/system/changes.adoc b/doc/system/changes.adoc index 1c03db3..1e49d32 100644 --- a/doc/system/changes.adoc +++ b/doc/system/changes.adoc @@ -27,6 +27,9 @@ http://www.boost.org/LICENSE_1_0.txt which success is not synonymous with 0. * The deprecated `boost::system::throws` object has been removed. * `boost::throws()` is now deprecated and its use is discouraged. +* The constructor of `system_error` taking a single `error_code` argument + is now explicit. +* `system_error::code()` now returns by value. ## Changes in Boost 1.68 diff --git a/doc/system/reference.adoc b/doc/system/reference.adoc index 89adcb1..7116343 100644 --- a/doc/system/reference.adoc +++ b/doc/system/reference.adoc @@ -363,6 +363,27 @@ Effects: :: `buffer`, truncating it to `len-1` characters and storing a null terminator. If `len` is 0, copies nothing. Returns `buffer`. If `message(ev)` throws an exception, the string `"Message text unavailable"` is used. +Example: :: ++ +``` +const char* my_category::message(int ev, char* buffer, size_t len) const noexcept +{ + switch(ev) + { + case 0: return "no error"; + case 1: return "voltage out of range"; + case 2: return "impedance mismatch"; + case 31: + case 32: + case 33: + std::snprintf(buffer, len, "component %d failure", ev-30); + return buffer; + default: + std::snprintf(buffer, len, "unknown error %d", ev); + return buffer; + } +} +``` ``` virtual bool failed( int ev ) const noexcept;