VectorNav C++ Library
exceptions.h
Go to the documentation of this file.
1 #ifndef _VN_EXCEPTIONS_H_
7 #define _VN_EXCEPTIONS_H_
8 
9 #include <stdexcept>
10 
11 namespace vn {
12 
14 class dimension_error : public std::runtime_error
15 {
16 public:
17  dimension_error() : runtime_error("dimension") { }
18 };
19 
21 class unknown_error : public std::exception
22 {
23 public:
24  unknown_error() : exception() { }
25 };
26 
29 class not_implemented : public std::logic_error
30 {
31 public:
32  not_implemented() : logic_error("Not implemented.") { }
33  explicit not_implemented(std::string msg) : logic_error(msg.c_str()) { }
34 };
35 
37 class null_pointer : public std::exception
38 {
39 public:
40  null_pointer() : exception() { }
41 };
42 
44 class invalid_operation : public std::runtime_error
45 {
46 public:
47  invalid_operation() : runtime_error("invalid operation") { }
48  explicit invalid_operation(std::string msg) : runtime_error(msg.c_str()) { }
49 };
50 
52 class permission_denied : public std::runtime_error
53 {
54 public:
55  permission_denied() : runtime_error("permission denied") { }
56  #if VN_SUPPORTS_CSTR_STRING_CONCATENATE
57  explicit permission_denied(std::string itemName) : runtime_error(std::string("Permission denied for item '" + itemName + "'.").c_str()) { }
58  #else
59  explicit permission_denied(std::string itemName) : runtime_error("Permission denied for item.") { }
60  #endif
61 };
62 
64 class not_supported : public std::exception
65 {
66 public:
67  not_supported() : exception() { }
68 };
69 
71 class not_found : public std::runtime_error
72 {
73 public:
74  explicit not_found(std::string msg) : runtime_error(msg) { }
75 };
76 
78 class invalid_format : public std::exception
79 {
80 public:
81  invalid_format() : exception() { }
82 };
83 
85 class timeout : public std::exception
86 {
87 public:
88  timeout() : exception() { }
89 
93  char const* what() const throw() { return "timeout"; }
94 };
95 
96 }
97 
98 #endif
Indicates the requested feature is not supported.
Definition: exceptions.h:64
Indicates that the requested functionality is not currently implemented.
Definition: exceptions.h:29
Indicates an invalid operation was attempted.
Definition: exceptions.h:44
Requested item not found.
Definition: exceptions.h:71
Indicates invalid permission for the operation.
Definition: exceptions.h:52
A timeout occurred.
Definition: exceptions.h:85
Indicates an unknown error occurred.
Definition: exceptions.h:21
Definition: attitude.h:8
char const * what() const
Returns a description of the exception.
Definition: exceptions.h:93
Exception class indicating that there as an dimensional error.
Definition: exceptions.h:14
Indicates a null pointer was provided.
Definition: exceptions.h:37
The format was invalid.
Definition: exceptions.h:78