receiver: handle exception when device is not available while being added

This commit is contained in:
Peter F. Patel-Schneider 2021-02-27 09:38:20 -05:00
parent a4b54df433
commit 9842972d8b
2 changed files with 8 additions and 0 deletions

View File

@ -392,3 +392,5 @@ def _process_receiver_event(action, device_info):
_error_callback('permissions', device_info.path)
except Exception:
_error_callback('permissions', device_info.path)
except _base.NoReceiver:
_error_callback('nodevice', device_info.path)

View File

@ -54,6 +54,12 @@ def _error_dialog(reason, object):
_('Found a Logitech Receiver (%s), but did not have permission to open it.') % object + '\n\n' +
_("If you've just installed Solaar, try removing the receiver and plugging it back in.")
)
elif reason == 'nodevice':
title = _('Cannot connect to device error')
text = (
_('Found a Logitech receiver or device at %s, but encountered an error connecting to it.') % object + '\n\n' +
_('Try removing the device and plugging it back in or turning it off and then on.')
)
elif reason == 'unpair':
title = _('Unpairing failed')
text = (