Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Exception, throw, handler?

Também chamado de: exception (C++) · throw expression · handler (exception)

Definition 1.14 University Computer Science — Year 2 · Capítulo 1 — From C to C++: Classes and Resource Management

An exception is an object that reports an error. A throw expression throw e; stops the current function and starts the search for a handler. A try block is followed by one or more handlers catch (const T &x) {body}: the first handler, in order, whose type T is the type of the exception or one of its base classes catches it. catch (...) catches anything, and throw; inside a handler throws the same exception again. If no handler catches it, the program ends.

Ler no capítulo →