libstdc++
Exceptions
Collaboration diagram for Exceptions:

Classes

struct  __gnu_cxx::forced_error
 

Macros

#define __cpp_lib_uncaught_exceptions
 

Typedefs

typedef void(* std::terminate_handler) ()
 
typedef void(* std::unexpected_handler) ()
 

Functions

 std::domain_error::domain_error (const char *) _GLIBCXX_TXN_SAFE
 
 std::domain_error::domain_error (const domain_error &)=default
 
 std::domain_error::domain_error (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::domain_error::domain_error (domain_error &&)=default
 
 std::exception::exception (const exception &)=default
 
 std::exception::exception (exception &&)=default
 
 std::__exception_ptr::exception_ptr::exception_ptr (const exception_ptr &) noexcept
 
 std::__exception_ptr::exception_ptr::exception_ptr (exception_ptr &&__o) noexcept
 
 std::__exception_ptr::exception_ptr::exception_ptr (nullptr_t) noexcept
 
 std::invalid_argument::invalid_argument (const char *) _GLIBCXX_TXN_SAFE
 
 std::invalid_argument::invalid_argument (const invalid_argument &)=default
 
 std::invalid_argument::invalid_argument (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::invalid_argument::invalid_argument (invalid_argument &&)=default
 
 std::length_error::length_error (const char *) _GLIBCXX_TXN_SAFE
 
 std::length_error::length_error (const length_error &)=default
 
 std::length_error::length_error (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::length_error::length_error (length_error &&)=default
 
 std::logic_error::logic_error (const char *) _GLIBCXX_TXN_SAFE
 
 std::logic_error::logic_error (const logic_error &)=default
 
 std::logic_error::logic_error (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::logic_error::logic_error (logic_error &&) noexcept
 
 std::nested_exception::nested_exception (const nested_exception &) noexcept=default
 
 std::out_of_range::out_of_range (const char *) _GLIBCXX_TXN_SAFE
 
 std::out_of_range::out_of_range (const out_of_range &)=default
 
 std::out_of_range::out_of_range (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::out_of_range::out_of_range (out_of_range &&)=default
 
 std::overflow_error::overflow_error (const char *) _GLIBCXX_TXN_SAFE
 
 std::overflow_error::overflow_error (const overflow_error &)=default
 
 std::overflow_error::overflow_error (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::overflow_error::overflow_error (overflow_error &&)=default
 
 std::range_error::range_error (const char *) _GLIBCXX_TXN_SAFE
 
 std::range_error::range_error (const range_error &)=default
 
 std::range_error::range_error (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::range_error::range_error (range_error &&)=default
 
 std::runtime_error::runtime_error (const char *) _GLIBCXX_TXN_SAFE
 
 std::runtime_error::runtime_error (const runtime_error &)=default
 
 std::runtime_error::runtime_error (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::runtime_error::runtime_error (runtime_error &&) noexcept
 
 std::underflow_error::underflow_error (const char *) _GLIBCXX_TXN_SAFE
 
 std::underflow_error::underflow_error (const string &__arg) _GLIBCXX_TXN_SAFE
 
 std::underflow_error::underflow_error (const underflow_error &)=default
 
 std::underflow_error::underflow_error (underflow_error &&)=default
 
const class std::type_infostd::__exception_ptr::exception_ptr::__cxa_exception_type () const noexcept
 
void __gnu_cxx::__verbose_terminate_handler ()
 
exception_ptr std::current_exception () noexcept
 
terminate_handler std::get_terminate () noexcept
 
unexpected_handler std::get_unexpected () noexcept
 
template<typename _Ex >
exception_ptr std::make_exception_ptr (_Ex __ex) noexcept
 
exception_ptr std::nested_exception::nested_ptr () const noexcept
 
 std::__exception_ptr::exception_ptr::operator bool () const
 
domain_errorstd::domain_error::operator= (const domain_error &)=default
 
exceptionstd::exception::operator= (const exception &)=default
 
exception_ptrstd::__exception_ptr::exception_ptr::operator= (const exception_ptr &) noexcept
 
invalid_argumentstd::invalid_argument::operator= (const invalid_argument &)=default
 
length_errorstd::length_error::operator= (const length_error &)=default
 
logic_errorstd::logic_error::operator= (const logic_error &)=default
 
nested_exceptionstd::nested_exception::operator= (const nested_exception &) noexcept=default
 
out_of_rangestd::out_of_range::operator= (const out_of_range &)=default
 
overflow_errorstd::overflow_error::operator= (const overflow_error &)=default
 
range_errorstd::range_error::operator= (const range_error &)=default
 
runtime_errorstd::runtime_error::operator= (const runtime_error &)=default
 
underflow_errorstd::underflow_error::operator= (const underflow_error &)=default
 
domain_errorstd::domain_error::operator= (domain_error &&)=default
 
exceptionstd::exception::operator= (exception &&)=default
 
exception_ptrstd::__exception_ptr::exception_ptr::operator= (exception_ptr &&__o) noexcept
 
invalid_argumentstd::invalid_argument::operator= (invalid_argument &&)=default
 
length_errorstd::length_error::operator= (length_error &&)=default
 
logic_errorstd::logic_error::operator= (logic_error &&) noexcept
 
out_of_rangestd::out_of_range::operator= (out_of_range &&)=default
 
overflow_errorstd::overflow_error::operator= (overflow_error &&)=default
 
range_errorstd::range_error::operator= (range_error &&)=default
 
runtime_errorstd::runtime_error::operator= (runtime_error &&) noexcept
 
underflow_errorstd::underflow_error::operator= (underflow_error &&)=default
 
void std::rethrow_exception (exception_ptr)
 
template<typename _Ex >
void std::rethrow_if_nested (const _Ex &__ex)
 
void std::nested_exception::rethrow_nested () const
 
terminate_handler std::set_terminate (terminate_handler) noexcept
 
unexpected_handler std::set_unexpected (unexpected_handler) noexcept
 
void std::__exception_ptr::exception_ptr::swap (exception_ptr &) noexcept
 
void std::terminate () noexcept
 
template<typename _Tp >
void std::throw_with_nested (_Tp &&__t)
 
bool std::uncaught_exception () noexcept
 
int std::uncaught_exceptions () noexcept
 
void std::unexpected ()
 
virtual const char * std::bad_exception::what () const noexcept
 
virtual const char * std::exception::what () const noexcept
 
virtual const char * std::logic_error::what () const noexcept
 
virtual const char * std::runtime_error::what () const noexcept
 

Friends

bool std::__exception_ptr::exception_ptr::operator== (const exception_ptr &, const exception_ptr &) noexcept
 
exception_ptr std::__exception_ptr::exception_ptr::std::current_exception () noexcept
 
template<typename _Ex >
exception_ptr std::__exception_ptr::exception_ptr::std::make_exception_ptr (_Ex) noexcept
 
void std::__exception_ptr::exception_ptr::std::rethrow_exception (exception_ptr)
 
bool operator== (const exception_ptr &, const exception_ptr &) noexcept
 

Detailed Description

Classes and functions for reporting errors via exception classes.

Typedef Documentation

◆ terminate_handler

typedef void(* std::terminate_handler) ()

If you write a replacement terminate handler, it must be of this type.

Definition at line 65 of file exception.

◆ unexpected_handler

typedef void(* std::unexpected_handler) ()

If you write a replacement unexpected handler, it must be of this type.

Definition at line 68 of file exception.

Function Documentation

◆ logic_error()

std::logic_error::logic_error ( const string __arg)
explicit

Takes a character string describing the error.

◆ runtime_error()

std::runtime_error::runtime_error ( const string __arg)
explicit

Takes a character string describing the error.

◆ __verbose_terminate_handler()

void __gnu_cxx::__verbose_terminate_handler ( )

A replacement for the standard terminate_handler which prints more information about the terminating exception (if any) on stderr.

Call

to use. For more info, see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html

In 3.4 and later, this is on by default.

◆ current_exception()

exception_ptr std::current_exception ( )
noexcept

Obtain an exception_ptr to the currently handled exception. If there is none, or the currently handled exception is foreign, return the null value.

◆ get_terminate()

terminate_handler std::get_terminate ( )
noexcept

Return the current terminate handler.

◆ get_unexpected()

unexpected_handler std::get_unexpected ( )
noexcept

Return the current unexpected handler.

◆ make_exception_ptr()

template<typename _Ex >
exception_ptr std::make_exception_ptr ( _Ex  __ex)
noexcept

Obtain an exception_ptr pointing to a copy of the supplied object.

Definition at line 186 of file exception_ptr.h.

◆ rethrow_exception()

void std::rethrow_exception ( exception_ptr  )

Throw the object pointed to by the exception_ptr.

◆ rethrow_if_nested()

template<typename _Ex >
void std::rethrow_if_nested ( const _Ex &  __ex)
inline

If __ex is derived from nested_exception, __ex.rethrow_nested().

Definition at line 159 of file nested_exception.h.

References std::__addressof().

◆ set_terminate()

terminate_handler std::set_terminate ( terminate_handler  )
noexcept

Takes a new handler function as an argument, returns the old function.

◆ set_unexpected()

unexpected_handler std::set_unexpected ( unexpected_handler  )
noexcept

Takes a new handler function as an argument, returns the old function.

◆ terminate()

void std::terminate ( )
noexcept

The runtime will call this function if exception handling must be abandoned for any reason. It can also be called by the user.

◆ throw_with_nested()

template<typename _Tp >
void std::throw_with_nested ( _Tp &&  __t)
inline

If __t is derived from nested_exception, throws __t. Else, throws an implementation-defined object derived from both.

Definition at line 118 of file nested_exception.h.

◆ uncaught_exception()

bool std::uncaught_exception ( )
noexcept

[18.6.4]/1: 'Returns true after completing evaluation of a throw-expression until either completing initialization of the exception-declaration in the matching handler or entering unexpected() due to the throw; or after entering terminate() for any reason other than an explicit call to terminate(). [Note: This includes stack unwinding [15.2]. end note]'

2: 'When uncaught_exception() is true, throwing an exception can result in a call of terminate() (15.5.1).'

◆ uncaught_exceptions()

int std::uncaught_exceptions ( )
noexcept

The number of uncaught exceptions.

◆ unexpected()

void std::unexpected ( )

The runtime will call this function if an exception is thrown which violates the function's exception specification.

◆ what() [1/4]

virtual const char* std::bad_exception::what ( ) const
virtualnoexcept

Returns a C-style character string describing the general cause of the current error.

Reimplemented from std::exception.

◆ what() [2/4]

virtual const char* std::exception::what ( ) const
virtualnoexcept

◆ what() [3/4]

virtual const char* std::logic_error::what ( ) const
virtualnoexcept

Returns a C-style character string describing the general cause of the current error (the same string passed to the ctor).

Reimplemented from std::exception.

Reimplemented in std::future_error.

◆ what() [4/4]

virtual const char* std::runtime_error::what ( ) const
virtualnoexcept

Returns a C-style character string describing the general cause of the current error (the same string passed to the ctor).

Reimplemented from std::exception.

Reimplemented in std::experimental::filesystem::v1::filesystem_error.

__gnu_cxx::__verbose_terminate_handler
void __verbose_terminate_handler()
A replacement for the standard terminate_handler which prints more information about the terminating ...
std::set_terminate
terminate_handler set_terminate(terminate_handler) noexcept
Takes a new handler function as an argument, returns the old function.