xtd 0.2.0
Loading...
Searching...
No Matches

◆ on_error()

template<typename type_t >
virtual void xtd::iobserver< type_t >::on_error ( const std::exception &  error)
pure virtualnoexcept

Notifies the observer that the provider has experienced an error condition.

Parameters
errorn object that provides additional information about the error.
Examples
The following example provides an implementation of the on_error method in a latitude/longitude tracking application. The method simply reports that data is currently unavailable; it does not make use of the std::exception object passed to it as a parameter. See the Example section of the xtd::iobserver<type_t> topic for the complete example.
void on_error(const std::exception& e) noexcept override {
console::write_line("{}: The location cannot be determined.", name());
}
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
virtual void on_error(const std::exception &error) noexcept=0
Notifies the observer that the provider has experienced an error condition.
@ e
The E key.