summaryrefslogtreecommitdiff
path: root/common/accel-base.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/accel-base.hpp')
-rw-r--r--common/accel-base.hpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/common/accel-base.hpp b/common/accel-base.hpp
index da2c96b..91510a4 100644
--- a/common/accel-base.hpp
+++ b/common/accel-base.hpp
@@ -2,13 +2,20 @@
#include "vec2.h"
-namespace rawaccel {
+void bad_arg(const char*);
+
+#ifndef _KERNEL_MODE
- // Error throwing calls std libraries which are unavailable in kernel mode.
- void error(const char* s);
+#include "rawaccel-error.hpp"
- using milliseconds = double;
+inline void bad_arg(const char* s) {
+ throw rawaccel::invalid_argument(s);
+}
+#endif
+
+namespace rawaccel {
+
/// <summary> Struct to hold arguments for an acceleration function. </summary>
struct accel_args {
double offset = 0;
@@ -60,7 +67,7 @@ namespace rawaccel {
/// </summary>
/// <param name="args">Arguments to verified.</param>
void verify(const accel_args& args) const {
- if (args.accel < 0) error("accel can not be negative, use a negative weight to compensate");
+ if (args.accel < 0) bad_arg("accel can not be negative, use a negative weight to compensate");
}
accel_base() = default;