From c7f881c86913f309f00f79289b2f3c88ce6919eb Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Tue, 11 Aug 2020 23:15:02 -0400 Subject: define exceptions for invalid arg & io errors --- common/rawaccel-error.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 common/rawaccel-error.hpp (limited to 'common/rawaccel-error.hpp') diff --git a/common/rawaccel-error.hpp b/common/rawaccel-error.hpp new file mode 100644 index 0000000..f5498f9 --- /dev/null +++ b/common/rawaccel-error.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +namespace rawaccel { + + class error : public std::runtime_error { + using std::runtime_error::runtime_error; + }; + + class invalid_argument : public error { + using error::error; + }; + + class io_error : public error { + using error::error; + }; + + class install_error : public io_error { + public: + install_error() : io_error("rawaccel is not installed") {} + }; + + class cooldown_error : public io_error { + public: + cooldown_error() : io_error("write is on cooldown") {} + }; + +} -- cgit v1.2.3