raiigraph
C++ RAII for igraph data structures
Loading...
Searching...
No Matches
error.hpp
Go to the documentation of this file.
1#ifndef RAIIGRAPH_ERROR_HPP
2#define RAIIGRAPH_ERROR_HPP
3
4#include "igraph.h"
5
11namespace raiigraph {
12
16class IgraphError : public std::runtime_error {
17public:
21 IgraphError(igraph_error_t code) : std::runtime_error(igraph_strerror(code)), code(code) {}
22
27 igraph_error_t code;
28};
29
34inline void check_code(igraph_error_t code) {
35 if (code != IGRAPH_SUCCESS) {
36 throw IgraphError(code);
37 }
38}
39
40}
41
42#endif
Error class for igraph-related errors.
Definition error.hpp:16
igraph_error_t code
Definition error.hpp:27
IgraphError(igraph_error_t code)
Definition error.hpp:21
Utilities for manipulating igraph data structures in C++.
Definition error.hpp:11
void check_code(igraph_error_t code)
Definition error.hpp:34