aboutsummaryrefslogtreecommitdiff
path: root/profiling
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-03-03 10:44:56 +0000
committerJim Flynn <jim.flynn@arm.com>2020-03-04 13:14:40 +0000
commita97a0be5f16cb876d7226b733ac6aaa3b79dabd3 (patch)
treeebbaf35fcddb6f0c3c15abf1ee8dd484ac2bc7ec /profiling
parentc3bf6efb48a4540c8addcc02813c9381e4fceb1f (diff)
downloadarmnn-a97a0be5f16cb876d7226b733ac6aaa3b79dabd3.tar.gz
IVGCVSW-4163 Enhance the error handling in the ReadPacket function
* Introduced armnn::SocketConnectionException with fields error no and socket info. Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: Ideb85b00771864e332226635aeff3096fbea8e5f
Diffstat (limited to 'profiling')
-rw-r--r--profiling/common/include/SocketConnectionException.hpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/profiling/common/include/SocketConnectionException.hpp b/profiling/common/include/SocketConnectionException.hpp
new file mode 100644
index 0000000000..58b8a14d6d
--- /dev/null
+++ b/profiling/common/include/SocketConnectionException.hpp
@@ -0,0 +1,51 @@
+//
+// Copyright © 2020 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+#pragma once
+
+#include <sstream>
+#include <stdexcept>
+#include <string>
+
+namespace armnnProfiling
+{
+
+/// Socket Connection Exception for profiling
+class SocketConnectionException : public std::exception
+{
+public:
+ explicit SocketConnectionException(const std::string& message, int socket)
+ : m_Message(message), m_Socket(socket), m_ErrNo(-1)
+ {};
+
+ explicit SocketConnectionException(const std::string& message, int socket, int errNo)
+ : m_Message(message), m_Socket(socket), m_ErrNo(errNo)
+ {};
+
+ /// @return - Error message of SocketProfilingConnection
+ virtual const char* what() const noexcept override
+ {
+ return m_Message.c_str();
+ }
+
+ /// @return - Socket File Descriptor of SocketProfilingConnection
+ /// or '-1', an invalid file descriptor
+ int GetSocketFd() const noexcept
+ {
+ return m_Socket;
+ }
+
+ /// @return - errno of SocketProfilingConnection
+ int GetErrorNo() const noexcept
+ {
+ return m_ErrNo;
+ }
+
+private:
+ std::string m_Message;
+ int m_Socket;
+ int m_ErrNo;
+};
+
+} // namespace armnnProfiling