summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/utils
diff options
context:
space:
mode:
authorschodet2004-04-16 16:46:46 +0000
committerschodet2004-04-16 16:46:46 +0000
commita3a3a4d6d183b22036a606cda8553192c98321cd (patch)
tree37d158408eabfbb8524d1214a985a44e376ee333 /2004/i/nono/src/utils
parente68b824329a537eddddd5b59b9bdf498698ee604 (diff)
Logger fonctionne.
MovementRotation aussi. Ajout de Serial::wait. Ajout de commentaires.
Diffstat (limited to '2004/i/nono/src/utils')
-rw-r--r--2004/i/nono/src/utils/errno_exception.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/2004/i/nono/src/utils/errno_exception.h b/2004/i/nono/src/utils/errno_exception.h
new file mode 100644
index 0000000..436a4c5
--- /dev/null
+++ b/2004/i/nono/src/utils/errno_exception.h
@@ -0,0 +1,25 @@
+#ifndef errno_exception_h
+#define errno_exception_h
+// errno_exception.h
+
+#include <string>
+#include <exception>
+#include <cstring>
+#include <errno.h>
+
+/// Exception lancé lorsqu'une erreur est retournée par la libc.
+class errno_exception : public std::exception
+{
+ int errno_;
+ std::string what_;
+ public:
+ errno_exception (const std::string &desc, int errno__)
+ : errno_ (errno__), what_ (desc + ": " + strerror (errno__)) { }
+ errno_exception (int errno__)
+ : errno_ (errno__), what_ (strerror (errno__)) { }
+ ~errno_exception (void) throw () { }
+ virtual const char* what () const throw () { return what_.c_str (); }
+ int getErrno (void) const { return errno_; }
+};
+
+#endif // errno_exception_h