Examples
User documentation
All exceptions thrown by CoCoALib are of a type derived from CoCoA::exception
.
An object of type CoCoA::exception
contains just 2 fields: a message
and
a context
(which may be empty). The intention is that the message
indicates what caused the exception, while context
may indicate where
the exception was thrown from (or it may be empty).
Note that CoCoA::exception
deliberately does not derive from std::exception
.
Constructors and pseudo-constructors
There are two constructors:
exception(mesg)
specify the message but no context (i.e. empty string)exception(mesg, where)
specify the message and a context
Queries and views
Let E
be an object of type exception
message(E)
gives the message insideE
as astd::string
context(E)
gives the context info insideE
as astd::string
Maintainer documentation
The class is very simple: it contains just two string data members, and two accessor functions.
Bugs, shortcomings and other ideas
Params are now std::string
rather than const std::string&
because that should be more efficient (sometimes) thanks to move-ctor:
the supplied arg is a copy, so can be moved into the data-structure.
Main changes
2021
- November (v0.99718): changed ctor args to
std::string
(previouslyconst std::string&
)
2015
- July (v0.99536): first release