Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on check internet connection #241

Open
vantu5z opened this issue Jun 13, 2023 · 0 comments
Open

Crash on check internet connection #241

vantu5z opened this issue Jun 13, 2023 · 0 comments

Comments

@vantu5z
Copy link

vantu5z commented Jun 13, 2023

Caught an exception on Mailnag star when internet is not available:

июн 13 09:38:47 vantu5zbook mailnag[1121]: ERROR (2023-06-13 09:38:47): Caught an exception.
                                              Traceback (most recent call last):
                                                File "/usr/lib/python3.11/site-packages/Mailnag/daemon/mailnagdaemon.py", line 165, in _start
                                                  if not self._wait_for_inet_connection():
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                File "/usr/lib/python3.11/site-packages/Mailnag/daemon/mailnagdaemon.py", line 212, in _wait_for_inet_connection
                                                  if self._conntest.is_offline():
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                File "/usr/lib/python3.11/site-packages/Mailnag/daemon/conntest.py", line 47, in is_offline
                                                  return (not self._monitor.can_reach(Gio.NetworkAddress.new(TEST_HOST, 8080)))
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                              gi.repository.GLib.GError: g-resolver-error-quark: Ошибка разрешения «www.google.com»: Временный сбой в разрешении имен (1)

To fix this, we can use try like this:

...
			else:
				try:
					return (not self._monitor.can_reach(Gio.NetworkAddress.new(TEST_HOST, 8080)))
				except:
					return False
....

About function Gio.NetworkMonitor.can_reach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant