aboutsummaryrefslogtreecommitdiffstats
path: root/src/tinyb_utils.cpp
diff options
context:
space:
mode:
authorPetre Eftime <[email protected]>2016-05-23 17:42:28 +0300
committerPetre Eftime <[email protected]>2016-05-23 18:17:45 +0300
commit69400113faa7541996c514360e82b355d4f1b102 (patch)
tree54f4f14e88105340e6e95f6e209d5e252445b674 /src/tinyb_utils.cpp
parent85e07cc8be5bf749fef345ac61b53a778d338d06 (diff)
c++, java: Add BluetoothException, throw it on DBus or BlueZ error
Signed-off-by: Petre Eftime <[email protected]>
Diffstat (limited to 'src/tinyb_utils.cpp')
-rw-r--r--src/tinyb_utils.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tinyb_utils.cpp b/src/tinyb_utils.cpp
index a1f2a5d..449ef1e 100644
--- a/src/tinyb_utils.cpp
+++ b/src/tinyb_utils.cpp
@@ -23,6 +23,7 @@
*/
#include "tinyb_utils.hpp"
+#include "BluetoothException.hpp"
std::vector<unsigned char> tinyb::from_gbytes_to_vector(const GBytes *bytes)
{
@@ -50,3 +51,12 @@ GBytes *tinyb::from_vector_to_gbytes(const std::vector<unsigned char>& vector)
return result;
}
+
+void tinyb::handle_error(GError *error)
+{
+ if (error != nullptr) {
+ BluetoothException e(error->message);
+ g_error_free(error);
+ throw e;
+ }
+}