mirror of
https://github.com/YunoHost/check-http.git
synced 2024-09-03 19:56:42 +02:00
Merge pull request #3 from YunoHost/new-exception
fix: handle OSError exception on asyncio sockets
This commit is contained in:
commit
7774e2baf2
1 changed files with 3 additions and 3 deletions
|
@ -182,7 +182,7 @@ async def check_http_domain(ip, domain, nonce):
|
|||
"status": "error_http_check_timeout",
|
||||
"content": "Timed-out while trying to contact your server from outside. It appears to be unreachable. You should check that you're correctly forwarding port 80, that nginx is running, and that a firewall is not interfering.",
|
||||
}
|
||||
except aiohttp.client_exceptions.ClientConnectorError as e:
|
||||
except (OSError, aiohttp.client_exceptions.ClientConnectorError) as e: # OSError: [Errno 113] No route to host
|
||||
return {
|
||||
"status": "error_http_check_connection_error",
|
||||
"content": "Connection error: could not connect to the requested domain, it's very likely unreachable. Raw error: " + str(e),
|
||||
|
@ -295,7 +295,7 @@ async def check_port_is_open(ip, port):
|
|||
|
||||
try:
|
||||
_, writer = await asyncio.wait_for(futur, timeout=2)
|
||||
except (asyncio.TimeoutError, ConnectionRefusedError):
|
||||
except (asyncio.TimeoutError, ConnectionRefusedError, OSError): # OSError: [Errno 113] No route to host
|
||||
return False
|
||||
except Exception:
|
||||
import traceback
|
||||
|
@ -350,7 +350,7 @@ async def check_smtp(request):
|
|||
|
||||
try:
|
||||
reader, writer = await asyncio.wait_for(futur, timeout=2)
|
||||
except (asyncio.TimeoutError, ConnectionRefusedError):
|
||||
except (asyncio.TimeoutError, ConnectionRefusedError, OSError): # OSError: [Errno 113] No route to host
|
||||
return json_response({
|
||||
'status': "error_smtp_unreachable",
|
||||
'content': "Could not open a connection on port 25, probably because of a firewall or port forwarding issue"
|
||||
|
|
Loading…
Reference in a new issue