aboutsummaryrefslogtreecommitdiff
path: root/src/exception.h
diff options
context:
space:
mode:
authorJan Sucan <jan@jansucan.com>2024-04-07 14:49:38 +0200
committerJán Sučan <jan@jansucan.com>2024-04-07 15:01:38 +0200
commit4d7dd62fcf8d0f1feb96dc0749aa3003750ff7eb (patch)
treebbd48b1302c3ad8e6cf98ff640159354a2f32393 /src/exception.h
parent43de68e11816e7836b32177dd2ec2e88f14564c5 (diff)
Add a common exception parent class
Diffstat (limited to 'src/exception.h')
-rw-r--r--src/exception.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/exception.h b/src/exception.h
new file mode 100644
index 0000000..99f8ee6
--- /dev/null
+++ b/src/exception.h
@@ -0,0 +1,39 @@
+/* Copyright 2024 Ján Sučan <jan@jansucan.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <stdexcept>
+#include <string>
+
+class DiffddError : public std::runtime_error
+{
+ public:
+ explicit DiffddError(const std::string &message)
+ : std::runtime_error(message)
+ {
+ }
+};