gattlib-py/exception: Handle -EINVAL

fix-build
Olivier Martin 2022-05-13 22:35:04 +02:00 committed by Olivier Martin
parent bae7df3ee0
commit ac1f3d44d5
1 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
# Copyright (c) 2016-2021, Olivier Martin <olivier@labapart.org> # Copyright (c) 2016-2022, Olivier Martin <olivier@labapart.org>
# #
GATTLIB_SUCCESS = 0 GATTLIB_SUCCESS = 0
@ -58,5 +58,7 @@ def handle_return(ret):
raise DeviceError() raise DeviceError()
elif ret == GATTLIB_ERROR_DBUS: elif ret == GATTLIB_ERROR_DBUS:
raise DBusError() raise DBusError()
elif ret == -22: # From '-EINVAL'
raise ValueError("Gattlib value error")
elif ret != 0: elif ret != 0:
raise RuntimeError("Gattlib exception %d" % ret) raise RuntimeError("Gattlib exception %d" % ret)