int or boolperror(), the global errno contains the last error codeperror() usage in the Linux kernel …h() only get h() errorsh() to g() and g() to f() are not propagatedthrowcatchtrycatch is associated with the code in the try blockException-handling code is error-handling code
std::logic_errorfaulty logic within the program, such as violating logical preconditions or class invariants, and may be preventable
std::invalid_argumentstd::domain_errorstd::length_errorstd::out_of_rangestd::runtime_errorerrors due to events beyond the scope of the program and where the program code cannot easily predict the error
std::range_errorstd::overflow_errorstd::underflow_errorcatch Handlersconst and volatile are ignoredcatch (...) matches any typecatch (Foo& e) matches any object of type Foo or any object of any class derived from Footry per Functionint and char*, but more challenging to determine what the error isstd::exceptioncatch handlers for std::exception will catch your throw&const is thrown away; not concerned about the advantages of const at this pointthrow;noexcept specifiervoid f() noexcept;void f();void f() throw();void f() throw(std::exception);std::exception and familytry block per function. It is a good idea to extract a function if more than one is needed.