forked from boostorg/system
Document system_error changes; add example for message(ev, buffer, len)
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user