summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLutz Bichler <Lutz.Bichler@bmw.de>2015-02-02 12:38:17 +0100
committerLutz Bichler <Lutz.Bichler@bmw.de>2015-02-02 12:38:17 +0100
commit9a580c2779c14ba30f13638e25b1f3cdef085493 (patch)
tree1474a68e1e98de559108ae240a3791d4744733ae
parent5f12188acebf57ef89574cb5c6df135bbb11e55f (diff)
downloadvSomeIP-9a580c2779c14ba30f13638e25b1f3cdef085493.tar.gz
Provide (a little) more readable error messages.
-rw-r--r--implementation/runtime/src/application_impl.cpp3
-rw-r--r--implementation/runtime/src/error.cpp22
-rw-r--r--interface/vsomeip/error.hpp6
3 files changed, 29 insertions, 2 deletions
diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp
index a7c53b0..85d95fb 100644
--- a/implementation/runtime/src/application_impl.cpp
+++ b/implementation/runtime/src/application_impl.cpp
@@ -288,7 +288,8 @@ void application_impl::on_message(std::shared_ptr<message> _message) {
}
void application_impl::on_error(error_code_e _error) {
- std::cerr << "ERROR " << (int) _error << std::endl;
+ VSOMEIP_ERROR << ERROR_INFO[static_cast<int>(_error)]
+ << " (" << static_cast<int>(_error) << ")";
}
// Interface "service_discovery_host"
diff --git a/implementation/runtime/src/error.cpp b/implementation/runtime/src/error.cpp
new file mode 100644
index 0000000..19f54f5
--- /dev/null
+++ b/implementation/runtime/src/error.cpp
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 BMW Group
+// Author: Lutz Bichler (lutz.bichler@bmw.de)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <vsomeip/error.hpp>
+
+namespace vsomeip {
+
+const char *ERROR_INFO[] = {
+ "Missing vsomeip configuration",
+ "Missing port configuration",
+ "Client endpoint creation failed"
+ "Server endpoint creation failed",
+ "Service property mismatch"
+};
+
+} // namespace vsomeip
+
+
+
diff --git a/interface/vsomeip/error.hpp b/interface/vsomeip/error.hpp
index dd435b7..305a776 100644
--- a/interface/vsomeip/error.hpp
+++ b/interface/vsomeip/error.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 BMW Group
+// Copyright (C) 2014-2015 BMW Group
// Author: Lutz Bichler (lutz.bichler@bmw.de)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,6 +7,8 @@
#ifndef VSOMEIP_ERROR_HPP
#define VSOMEIP_ERROR_HPP
+#include <vsomeip/primitive_types.hpp>
+
namespace vsomeip {
enum class error_code_e : uint8_t {
@@ -17,6 +19,8 @@ enum class error_code_e : uint8_t {
SERVICE_PROPERTY_MISMATCH
};
+extern const char *ERROR_INFO[];
+
} // namespace vsomeip
#endif // VSOMEIP_ERROR_HPP