|
BDE 4.14.0 Production release
|
Provide a standard compliant system_error class.
Canonical header: bsl_system_error.h
This component defines class bsl::system_error, a class used for annotated exception objects about errno-style errors. In C++11 mode, the vendor-supplied <system_error> implementation is used instead, and the corresponding names from std are imported into bsl.
In this section we show intended use of this component.
Suppose we want to add an informative message when a system error occurs and include that as part of an exception that we throw when reporting the error. We can use bsl::system_error to do that.
First, reset errno to avoid detecting old problems.
Then, do something that will fail and set errno.
Next, check that errno was actually set.
Finally, prepare an annotated exception and verify the annotation and the error code stored within it.