# Poco

# class Exception

Library: Foundation
Package: Core
Header: Poco/Exception.h

## Description

This is the base class for all exceptions defined in the Poco class library.

## Inheritance

Direct Base Classes: std::exception

All Base Classes: std::exception

Known Derived Classes: Poco::Data::MySQL::MySQLException, Poco::Data::MySQL::ConnectionException, Poco::Data::MySQL::StatementException, Poco::Data::ODBC::ODBCException, Poco::Data::ODBC::InsufficientStorageException, Poco::Data::ODBC::UnknownDataLengthException, Poco::Data::ODBC::DataTruncatedException, Poco::Data::ODBC::HandleException, Poco::Data::SQLite::SQLiteException, Poco::Data::SQLite::InvalidSQLStatementException, Poco::Data::SQLite::InternalDBErrorException, Poco::Data::SQLite::DBAccessDeniedException, Poco::Data::SQLite::ExecutionAbortedException, Poco::Data::SQLite::LockedException, Poco::Data::SQLite::DBLockedException, Poco::Data::SQLite::TableLockedException, Poco::Data::SQLite::NoMemoryException, Poco::Data::SQLite::ReadOnlyException, Poco::Data::SQLite::InterruptException, Poco::Data::SQLite::IOErrorException, Poco::Data::SQLite::CorruptImageException, Poco::Data::SQLite::TableNotFoundException, Poco::Data::SQLite::DatabaseFullException, Poco::Data::SQLite::CantOpenDBFileException, Poco::Data::SQLite::LockProtocolException, Poco::Data::SQLite::SchemaDiffersException, Poco::Data::SQLite::RowTooBigException, Poco::Data::SQLite::ConstraintViolationException, Poco::Data::SQLite::DataTypeMismatchException, Poco::Data::SQLite::ParameterCountMismatchException, Poco::Data::SQLite::InvalidLibraryUseException, Poco::Data::SQLite::OSFeaturesMissingException, Poco::Data::SQLite::AuthorizationDeniedException, Poco::Data::SQLite::TransactionException, Poco::Data::DataException, Poco::Data::RowDataMissingException, Poco::Data::UnknownDataBaseException, Poco::Data::UnknownTypeException, Poco::Data::ExecutionException, Poco::Data::BindingException, Poco::Data::ExtractException, Poco::Data::LimitException, Poco::Data::NotSupportedException, Poco::Data::NotImplementedException, Poco::Data::SessionUnavailableException, Poco::Data::SessionPoolExhaustedException, LogicException, AssertionViolationException, NullPointerException, BugcheckException, InvalidArgumentException, NotImplementedException, RangeException, IllegalStateException, InvalidAccessException, SignalException, UnhandledException, RuntimeException, NotFoundException, ExistsException, TimeoutException, SystemException, RegularExpressionException, LibraryLoadException, LibraryAlreadyLoadedException, NoThreadAvailableException, PropertyNotSupportedException, PoolOverflowException, NoPermissionException, OutOfMemoryException, DataException, DataFormatException, SyntaxException, CircularReferenceException, PathSyntaxException, IOException, ProtocolException, FileException, FileExistsException, FileNotFoundException, PathNotFoundException, FileReadOnlyException, FileAccessDeniedException, CreateFileException, OpenFileException, WriteFileException, ReadFileException, UnknownURISchemeException, ApplicationException, BadCastException, Poco::Net::InvalidAddressException, Poco::Net::NetException, Poco::Net::ServiceNotFoundException, Poco::Net::ConnectionAbortedException, Poco::Net::ConnectionResetException, Poco::Net::ConnectionRefusedException, Poco::Net::DNSException, Poco::Net::HostNotFoundException, Poco::Net::NoAddressFoundException, Poco::Net::InterfaceNotFoundException, Poco::Net::NoMessageException, Poco::Net::MessageException, Poco::Net::MultipartException, Poco::Net::HTTPException, Poco::Net::NotAuthenticatedException, Poco::Net::UnsupportedRedirectException, Poco::Net::FTPException, Poco::Net::SMTPException, Poco::Net::POP3Exception, Poco::Net::ICMPException, Poco::Net::SSLException, Poco::Net::SSLContextException, Poco::Net::InvalidCertificateException, Poco::Net::CertificateValidationException, Poco::Util::OptionException, Poco::Util::UnknownOptionException, Poco::Util::AmbiguousOptionException, Poco::Util::MissingOptionException, Poco::Util::MissingArgumentException, Poco::Util::InvalidArgumentException, Poco::Util::UnexpectedArgumentException, Poco::Util::IncompatibleOptionsException, Poco::Util::DuplicateOptionException, Poco::Util::EmptyOptionException, Poco::XML::DOMException, Poco::XML::EventException, Poco::XML::SAXException, Poco::XML::SAXNotRecognizedException, Poco::XML::SAXNotSupportedException, Poco::XML::SAXParseException, Poco::XML::XMLException, Poco::Zip::ZipException, Poco::Zip::ZipManipulationException

## Member Summary

Member Functions: className, clone, code, displayText, extendedMessage, message, name, nested, operator =, rethrow, what

## Constructors

### Exception

Exception(
const Exception & exc
);

Copy constructor.

### Exception

Exception(
const std::string & msg,
int code = 0
);

Creates an exception.

### Exception

Exception(
const std::string & msg,
const std::string & arg,
int code = 0
);

Creates an exception.

### Exception

Exception(
const std::string & msg,
const Exception & nested,
int code = 0
);

Creates an exception and stores a clone of the nested exception.

### Exception

Exception(
int code = 0
);

Standard constructor.

## Destructor

### ~Exception

~Exception();

Destroys the exception and deletes the nested exception.

## Member Functions

### className

virtual const char * className() const;

Returns the name of the exception class.

### clone

virtual Exception * clone() const;

Creates an exact copy of the exception.

The copy can later be thrown again by invoking rethrow() on it.

### code

int code() const;

Returns the exception code if defined.

### displayText

std::string displayText() const;

Returns a string consisting of the message name and the message text.

### message

const std::string & message() const;

Returns the message text.

### name

virtual const char * name() const;

Returns a static string describing the exception.

### nested

const Exception * nested() const;

Returns a pointer to the nested exception, or null if no nested exception exists.

### operator =

Exception & operator = (
const Exception & exc
);

Assignment operator.

### rethrow

virtual void rethrow() const;

(Re)Throws the exception.

This is useful for temporarily storing a copy of an exception (see clone()), then throwing it again.

### what

virtual const char * what() const;

Returns a static string describing the exception.

Same as name(), but for compatibility with std::exception.

### extendedMessage

void extendedMessage(
const std::string & arg
);

Sets the extended message for the exception.

### message

void message(
const std::string & msg
);

Sets the message for the exception.