This commit is contained in:
2023-08-20 14:07:03 +03:00
parent 017537edf7
commit 61cecc52dd
5 changed files with 37 additions and 18 deletions

View File

@@ -154,11 +154,13 @@ class QualtestBackend:
try:
response = urllib.request.urlopen(url, timeout=utils.NETWORK_TIMEOUT)
if response.getcode() != 200:
utils.log_error("Failed to get task list. Error code: %s" % response.getcode())
return None
raise RuntimeError(f'Failed to load phone definition. Error code: {response.getcode()}')
except Exception as e:
utils.log_error(f'Problem when loading the phone definition.')
return cache.get_phone(self.instance)
utils.log_error(f'Problem when loading the phone definition from backend. Error: {str(e)}')
r = cache.get_phone(self.instance)
if r is None:
raise RuntimeError(f'No cached phone definition.')
return r
# Get possible list of phones
phones = json.loads(response.read().decode())
@@ -199,8 +201,8 @@ class QualtestBackend:
return result
except Exception as err:
utils.log_error("Exception when fetching task list: {0}".format(err))
return dict()
utils.log_error(f"Exception when fetching task list: {str(err)}")
return None
def load_audio(self, audio_id: int, output_path: Path):