You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Dbus methods can return errors instead of returning expected value. I could not find simple example or good documentation on how to handle them. A simple example showing how to handle common errors should be provided, as well as adding a paragraph in the documentation/tutorial.
void Register()
Attempts to register to the default network. The
default network is normally selected by the settings
from the SIM card.
Possible Errors: [service].Error.InProgress
[service].Error.NotImplemented
[service].Error.Failed
[service].Error.AccessDenied
And I got this stack trace today:
dbus_op.Register()
File "/usr/local/lib/python3.4/dist-packages/pydbus/proxy_method.py", line 75, in __call__
0, timeout_to_glib(timeout), None).unpack()
GLib.Error: g-io-error-quark: GDBus.Error:org.ofono.Error.InProgress: Operation already in progress (36)
For now I'll try to do something like this, but it's still not clear to me whether this is correct or not:
try:
netreg.Register()
except org.ofono.Error.InProgress as e:
self.log('Register already in progress', e)
The text was updated successfully, but these errors were encountered:
from gi.repository.GLib import GError
...
try:
thing()
except GError as e:
if 'dbus.Error.Name' in str(e.args):
print('Deal with this error')
else:
raise e
still learning python, so not sure if that's right, but it is handling the exception.
In Dbus methods can return errors instead of returning expected value. I could not find simple example or good documentation on how to handle them. A simple example showing how to handle common errors should be provided, as well as adding a paragraph in the documentation/tutorial.
For instance, from ofono https://git.kernel.org/pub/scm/network/ofono/ofono.git/tree/doc/network-api.txt:
And I got this stack trace today:
For now I'll try to do something like this, but it's still not clear to me whether this is correct or not:
The text was updated successfully, but these errors were encountered: