aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/Exceptions.hpp
diff options
context:
space:
mode:
authortelsoa01 <telmo.soares@arm.com>2018-03-09 14:13:49 +0000
committertelsoa01 <telmo.soares@arm.com>2018-03-09 14:13:49 +0000
commit4fcda0101ec3d110c1d6d7bee5c83416b645528a (patch)
treec9a70aeb2887006160c1b3d265c27efadb7bdbae /include/armnn/Exceptions.hpp
downloadarmnn-4fcda0101ec3d110c1d6d7bee5c83416b645528a.tar.gz
Release 18.02
Change-Id: Id3c11dc5ee94ef664374a988fcc6901e9a232fa6
Diffstat (limited to 'include/armnn/Exceptions.hpp')
-rw-r--r--include/armnn/Exceptions.hpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/include/armnn/Exceptions.hpp b/include/armnn/Exceptions.hpp
new file mode 100644
index 0000000000..0b043997c4
--- /dev/null
+++ b/include/armnn/Exceptions.hpp
@@ -0,0 +1,75 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// See LICENSE file in the project root for full license information.
+//
+#pragma once
+
+#include <stdexcept>
+#include <string>
+
+namespace armnn
+{
+
+// base class for all ArmNN exceptions so that users can filter to just those
+class Exception : public std::exception
+{
+public:
+ explicit Exception(const std::string& message);
+
+ virtual const char* what() const noexcept override;
+
+private:
+ std::string m_Message;
+};
+
+class ClRuntimeUnavailableException : public Exception
+{
+public:
+ using Exception::Exception;
+};
+
+class InvalidArgumentException : public Exception
+{
+public:
+ using Exception::Exception;
+};
+
+class FileNotFoundException : public Exception
+{
+public:
+ using Exception::Exception;
+};
+
+class ParseException : public Exception
+{
+public:
+ using Exception::Exception;
+};
+
+class UnimplementedException : public Exception
+{
+public:
+ using Exception::Exception;
+ UnimplementedException();
+};
+
+class LayerValidationException : public Exception
+{
+ using Exception::Exception;
+};
+
+class GraphValidationException : public Exception
+{
+ using Exception::Exception;
+};
+
+template <typename ExceptionType>
+void ConditionalThrow(bool condition, const std::string& message)
+{
+ if (!condition)
+ {
+ throw ExceptionType(message);
+ }
+}
+
+}