Espaces de noms
Variantes
Affichages
Actions

std::bad_exception

De cppreference.com
< cpp‎ | error

 
 
 
Erreur de manipulation
La gestion des exceptions
Original:
Exception handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
exception
uncaught_exception
exception_ptr (C++11)
make_exception_ptr (C++11)
current_exception (C++11)
rethrow_exception (C++11)
nested_exception (C++11)
throw_with_nested (C++11)
rethrow_if_nested (C++11)
Défaillances de gestion des exceptions
Original:
Exception handling failures
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
terminate
terminate_handler
get_terminate (C++11)
set_terminate
unexpected (obsolète)
bad_exception
unexpected_handler (obsolète)
get_unexpected (C++11) (obsolète)
set_unexpected (obsolète)
Catégories d'exception
Original:
Exception categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
logic_error
invalid_argument
domain_error
length_error
out_of_range
runtime_error
range_error
overflow_error
underflow_error
Les codes d'erreur
Original:
Error codes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Les codes d'erreur
errno
Les assertions
Original:
Assertions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
assert
system_error installation
Original:
system_error facility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
error_category (C++11)
generic_category (C++11)
system_category (C++11)
error_condition (C++11)
errc (C++11)
error_code (C++11)
system_error (C++11)
 
Defined in header <exception>
class bad_exception;
std::bad_exception est le type de l'exception levée par le runtime C + + dans les situations suivantes:
Original:
std::bad_exception is the type of the exception thrown by the C++ runtime in the following situations:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Si un spécification d'exception dynamique est violée et std::unexpected lance ou lève de nouveau une exception qui viole encore la spécification d'exception, mais la spécification d'exception permet std::bad_exception, std::bad_exception est lancée .
Original:
If a spécification d'exception dynamique is violated and std::unexpected throws or rethrows an exception that still violates the exception specification, but the exception specification allows std::bad_exception, std::bad_exception is thrown.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Si std::exception_ptr stocke une copie de l'exception interceptée et si le constructeur de copie de l'objet exception interceptée par current_exception lève une exception, l'exception capturée est une instance de std::bad_exception .
Original:
If std::exception_ptr stores a copy of the caught exception and if the copy constructor of the exception object caught by current_exception throws an exception, the captured exception is an instance of std::bad_exception.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cpp/error/exceptionstd-bad exception-inheritance.svg
À propos de cette image

Inheritance diagram

Sommaire

[modifier] Fonctions membres

construit l'objet bad_exception
Original:
constructs the bad_exception object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique)
copie de l'objet
Original:
copies the object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique)
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
renvoie la chaîne explicative
Original:
returns the explanatory string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(function membre virtuelle publique)

Inherited from std::exception

Member functions

[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
Détruit l'objet exception
Original:
destructs the exception object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(function membre virtuelle publique de std::exception) [edit]
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
retourne une chaîne explicative
Original:
returns an explanatory string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(function membre virtuelle publique de std::exception) [edit]

[modifier] Exemple

#include <iostream>
#include <exception>
#include <stdexcept>
 
void my_unexp() { throw; }
 
void test() throw(std::bad_exception)
{
    throw std::runtime_error("test");
}
 
int main()
{
    std::set_unexpected(my_unexp);
    try {
         test();
    } catch(const std::bad_exception& e)
    {
        std::cerr << "Caught " << e.what() << '\n';
    }
}

Résultat :

Caught std::bad_exception