#include <GraphException.hpp>
This should be thrown by using the macro for exception calling:
throw GraphEx(invalid_node); throw GraphExMsg(invalid_node, "custome error message");
Excample for catching an exception:
try { Node no_node = graph->node("i don't exist"); } catch( GraphException &e ) { e.print(); }
Public Types | |
| enum | error { undefined, invalid_node, invalid_node_id, duplicate_node_id, invalid_edge, invalid_edge_id, duplicate_edge_id, duplicate_id, invalid_id, invalid_property, invalid_property_type, cannot_step } |
| Error numbers. More... | |
Public Member Functions | |
| GraphException () | |
| Empty Constructor. | |
| GraphException (error e, std::string msg, const int line=0, const char *file=NULL) | |
| Constructor. | |
| GraphException (const GraphException &ex) | |
| Copy Constructor. | |
| virtual | ~GraphException () |
| Destructor. | |
| virtual void | halt () |
| Print exception and halt program. | |
| virtual void | print () |
| Print Exception. | |
| virtual std::string | message () |
| Return exception message. | |
| virtual error | exception () |
| Return exception type. | |
Static Public Attributes | |
| static const char * | messages [] |
| Exception messages. | |
Private Attributes | |
| int | e |
| The exception. | |
| std::string | msg |
| A custom message. | |
| int | line |
| The line in which the exception occured. | |
| const char * | file |
| The file in which the exception occured. | |
|
|
|
Empty Constructor.
|
|
||||||||||||||||||||
|
Constructor.
|
|
|
Copy Constructor.
|
|
|
Destructor.
|
|
|
Return exception type.
|
|
|
Print exception and halt program.
|
|
|
Return exception message.
|
|
|
Print Exception.
|
|
|
The exception.
|
|
|
The file in which the exception occured.
|
|
|
The line in which the exception occured.
|
|
|
Initial value: {
"Undefined error",
"Invalid node",
"Invalid node ID",
"Trying to set the ID of a node to a value which was already in use",
"Invalid edge",
"Invalid edge ID",
"Trying to set the ID of an edge to a value which was already in use",
"Trying to set the ID for a node/edge where the id was already in use",
"Invalid ID",
"Property does not exist",
"The property type did not match the type of the new value",
"Hierarchy: step() failed. Either there were no nodes given, or you were trying to make a deque",
}
|
|
|
A custom message.
|
1.4.1