fix: raise ValueErrors rather than return

pull/880/head
Callum Leslie 2 years ago
parent 1d3410646d
commit 3068cead0c
No known key found for this signature in database
GPG Key ID: D382C4AFEECEAA90

@ -37,7 +37,7 @@ class AWSPolly:
voice = self.randomvoice()
else:
if not settings.config["settings"]["tts"]["aws_polly_voice"]:
return ValueError(
raise ValueError(
f"Please set the TOML variable AWS_VOICE to a valid voice. options are: {voices}"
)
voice = str(settings.config["settings"]["tts"]["aws_polly_voice"]).capitalize()
@ -64,10 +64,12 @@ class AWSPolly:
sys.exit(-1)
except ProfileNotFound:
print("You need to install the AWS CLI and configure your profile")
print("""
print(
"""
Linux: https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html
Windows: https://docs.aws.amazon.com/polly/latest/dg/install-voice-plugin2.html
""")
"""
)
sys.exit(-1)
def randomvoice(self):

@ -37,7 +37,7 @@ class StreamlabsPolly:
voice = self.randomvoice()
else:
if not settings.config["settings"]["tts"]["streamlabs_polly_voice"]:
return ValueError(
raise ValueError(
f"Please set the config variable STREAMLABS_VOICE to a valid voice. options are: {voices}"
)
voice = str(settings.config["settings"]["tts"]["streamlabs_polly_voice"]).capitalize()
@ -51,7 +51,7 @@ class StreamlabsPolly:
voice_data = requests.get(response.json()["speak_url"])
with open(filepath, "wb") as f:
f.write(voice_data.content)
except (KeyError, JSONDecodeError) as e:
except (KeyError, JSONDecodeError):
try:
if response.json()["error"] == "No text specified!":
raise ValueError("Please specify a text to convert to speech.")

Loading…
Cancel
Save