Files
openmethod/doc/error_handler.adoc
Jean-Louis Leroy 5e0fa8ee4b inception
2025-03-08 15:31:25 -05:00

64 lines
1.2 KiB
Plaintext

## error_handler
### Synopsis
Defined in <boost/openmethod/policies/basic_policy.hpp>.
```c++
namespace boost::openmethod::policies {
struct error_handler;
}
```
Defined in <boost/openmethod/types.hpp>.
```c++
namespace boost::openmethod {
struct openmethod_error {};
struct not_implemented_error : openmethod_error {
type_id method;
std::size_t arity;
static constexpr std::size_t max_types = 16;
type_id types[max_types];
};
struct unknown_class_error : openmethod_error {
type_id type;
};
struct hash_search_error : openmethod_error {
std::size_t attempts;
std::size_t buckets;
};
struct type_mismatch_error : openmethod_error {
type_id type;
};
} // boost::openmethod::policies
```
### Description
`error_handler` is a facet that handles errors.
When an error is encountered, either during `initialize` or method dispatch, the
program is terminated via a call to `abort`. If this facet is present in the
policy, its `error` function is called with an error object. It can prevent
termination by throwing an exception.
### Requirements
Implementations of `error_handler` must provide the following functions:
#### error
```c++
| static auto error(const T&) -> void;
```