Error handling
Материал из cppreference.com
< cpp
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
[править] Обработка исключений
В заголовке
<exception> предоставляет несколько классов и функций, связанных с обработкой исключений в C + + программ.Original:
The header
<exception> provides several classes and functions related to exception handling in C++ programs.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Определено в файле <exception>
| |
| Базовый класс для исключений, библиотеки стандартных компонентов Original: base class for exceptions thrown by the standard library components The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
Original: Capture and storage of exception objects The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| проверяет, является ли обработка исключений является в настоящее время Original: checks if exception handling is currently in progress The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
| (C++11) |
общий тип указателя для обработки исключения объектов Original: shared pointer type for handling exception objects The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (определение типа) |
| (C++11) |
создает std::exception_ptr от объекта исключения Original: creates an std::exception_ptr from an exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (шаблон функции) |
| (C++11) |
captures the current exception in a std::exception_ptr (функция) |
| (C++11) |
бросает исключение из std::exception_ptr Original: throws the exception from an std::exception_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) |
| (C++11) |
Тип примесь для сбора и хранения текущей исключения Original: a mixin type to capture and store current exceptions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |
| (C++11) |
бросает свой спор с std::nested_exception ввязался Original: throws its argument with std::nested_exception mixed in The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (шаблон функции) |
| (C++11) |
бросает исключение из std::nested_exception Original: throws the exception from a std::nested_exception The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (шаблон функции) |
Original: Handling of failures in exception handling The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| Функция вызывается при обработке исключений не удается Original: function called when exception handling fails The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
| Тип функции вызываются std::terminate Original: the type of the function called by std::terminate The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (определение типа) | |
| (C++11) |
получает текущий terminate_handler Original: obtains the current terminate_handler The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) |
| изменения функцию, которая будет вызываться std::terminate Original: changes the function to be called by std::terminate The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
Original: Handling of exception specification violations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (устарело) |
Функция вызывается, когда динамическая спецификация исключений нарушается Original: function called when dynamic exception specification is violated The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) |
| исключение, когда динамическая спецификация исключений нарушается, если это возможно Original: exception thrown when dynamic exception specification is violated, if possible The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| (устарело) |
Тип функции вызываются std::unexpected Original: the type of the function called by std::unexpected The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (определение типа) |
| (C++11)(устарело) |
получает текущий unexpected_handler Original: obtains the current unexpected_handler The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) |
| (устарело) |
изменения функцию, которая будет вызываться std::unexpected Original: changes the function to be called by std::unexpected The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) |
[править] Исключение категорий
Несколько классов удобства предварительно определены в заголовке
<stdexcept> сообщить конкретные условия ошибки. Эти классы можно разделить на две категории: Логика и ошибки времени выполнения ошибок. Логические ошибки являются следствием порочной логике в рамках программы и можно предотвратить. Ошибки времени выполнения в связи с событиями выходит за рамки программы и не может быть легко предсказано.Original:
Several convenience classes are predefined in the header
<stdexcept> to report particular error conditions. These classes can be divided into two categories: logic errors and runtime errors. Logic errors are a consequence of faulty logic within the program and may be preventable. Runtime errors are due to events beyond the scope of the program and can not be easily predicted.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Определено в файле <stdexcept>
| |
| Исключение класса, чтобы указать нарушения логических предпосылок или класс инвариантов Original: exception class to indicate violations of logical preconditions or class invariants The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса сообщать неверные аргументы Original: exception class to report invalid arguments The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса сообщить домена ошибок Original: exception class to report domain errors The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса сообщить попытки превышает максимально допустимый размер Original: exception class to report attempts to exceed maximum allowed size The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса сообщить аргументы за пределы ожидаемого диапазона Original: exception class to report arguments outside of expected range The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса указать условия обнаружить только во время выполнения Original: exception class to indicate conditions only detectable at run time The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса сообщить диапазон ошибки во внутренних расчетах Original: exception class to report range errors in internal computations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса сообщить арифметическое переполнение Original: exception class to report arithmetic overflows The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
| Исключение класса сообщить арифметических недостаточному Original: exception class to report arithmetic underflows The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |
[править] Ошибка номера
| Определено в файле <cerrno>
| |
| макрос, который расширяется в POSIX-совместимых потоков местного variable
(макропеременной) номер ошибки Original: macro which expands to POSIX-compatible thread-local error number variable (макропеременной) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| макросы для стандартных POSIX-совместимых условий ошибки Original: macros for standard POSIX-compatible error conditions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (константа-макрос) | |
[править] Утверждений
Утверждения способствовать осуществлению проверки предпосылок в программах.
Original:
Assertions help to implement checking of preconditions in programs.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| статическое утверждение | выполняется во время компиляции проверку утверждений (начиная с C++11)
Original: performs compile-time assertion checking (начиная с C++11) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| Определено в файле <cassert>
| |
| прерывает программу, если указанный пользователем условие не является true. Может быть отключена для версии релиза Original: aborts the program if the user-specified condition is not true. May be disabled for release builds The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция-макрос) | |
[править] Системная ошибка
В заголовке
<system_error> определяет виды и функции, используемые для сообщить об ошибке состояния, возникающие от операционной системы, потоки ввода / вывода, std::future или других низкоуровневых API-интерфейсов.Original:
The header
<system_error> defines types and functions used to report error conditions originating from the operating system, streams I/O, std::future, or other low-level APIs.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Определено в файле <system_error>
| |
| (C++11) |
Базовый класс для категорий ошибок Original: base class for error categories The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |
| (C++11) |
определяет общие категории ошибка Original: identifies the generic error category The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) |
| (C++11) |
определяет операционные системы категорий ошибке Original: identifies the operating system error category The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) |
| (C++11) |
имеет портативный код ошибки Original: holds a portable error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |
| (C++11) |
std::error_condition перечисление списка всех стандартных макросов <cerrno> константOriginal: the std::error_condition enumeration listing all standard <cerrno> macro constantsThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |
| (C++11) |
проводит зависит от платформы код ошибки Original: holds a platform-dependent error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |
| (C++11) |
Исключение класса используется, чтобы сообщить условия, которые должны error_code Original: exception class used to report conditions that have an error_code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |