forked from p34709852/monkey
Refactored exception name to a more specific one
This commit is contained in:
parent
7abafb70e1
commit
a77743137f
|
@ -22,5 +22,5 @@ class AlreadyRegisteredError(RegistrationNotNeededError):
|
||||||
""" Raise to indicate the reason why registration is not required """
|
""" Raise to indicate the reason why registration is not required """
|
||||||
|
|
||||||
|
|
||||||
class NoInternetError(Exception):
|
class VersionServerConnectionError(Exception):
|
||||||
""" Raise to indicate problems caused when no internet connection is present"""
|
""" Raise to indicate that connection to version update server failed """
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import monkey_island.cc.environment.environment_singleton as env_singleton
|
import monkey_island.cc.environment.environment_singleton as env_singleton
|
||||||
from common.utils.exceptions import NoInternetError
|
from common.utils.exceptions import VersionServerConnectionError
|
||||||
from common.version import get_version
|
from common.version import get_version
|
||||||
|
|
||||||
__author__ = "itay.mizeretz"
|
__author__ = "itay.mizeretz"
|
||||||
|
@ -30,7 +30,7 @@ class VersionUpdateService:
|
||||||
if VersionUpdateService.newer_version is None:
|
if VersionUpdateService.newer_version is None:
|
||||||
try:
|
try:
|
||||||
VersionUpdateService.newer_version = VersionUpdateService._check_new_version()
|
VersionUpdateService.newer_version = VersionUpdateService._check_new_version()
|
||||||
except NoInternetError:
|
except VersionServerConnectionError:
|
||||||
logger.info('Failed updating version number')
|
logger.info('Failed updating version number')
|
||||||
|
|
||||||
return VersionUpdateService.newer_version
|
return VersionUpdateService.newer_version
|
||||||
|
@ -47,7 +47,7 @@ class VersionUpdateService:
|
||||||
reply = requests.get(url, timeout=7)
|
reply = requests.get(url, timeout=7)
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
logger.info("Can't get latest monkey version, probably no connection to the internet.")
|
logger.info("Can't get latest monkey version, probably no connection to the internet.")
|
||||||
raise NoInternetError
|
raise VersionServerConnectionError
|
||||||
|
|
||||||
res = reply.json().get('newer_version', None)
|
res = reply.json().get('newer_version', None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue