Merge pull request #35 from classabbyamp/bare-excepts

fixed bare excepts
This commit is contained in:
0x5c 2019-10-12 20:24:40 -04:00 committed by GitHub
commit baede1099a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ class MorseCog(commands.Cog):
for char in msg.upper(): for char in msg.upper():
try: try:
result += self.ascii2morse[char] result += self.ascii2morse[char]
except: except KeyError:
result += '<?>' result += '<?>'
result += ' ' result += ' '
embed = discord.Embed(title=f'Morse Code for {msg}', embed = discord.Embed(title=f'Morse Code for {msg}',
@ -53,7 +53,7 @@ class MorseCog(commands.Cog):
for char in word: for char in word:
try: try:
result += self.morse2ascii[char] result += self.morse2ascii[char]
except: except KeyError:
result += '<?>' result += '<?>'
result += ' ' result += ' '
embed = discord.Embed(title=f'ASCII for {msg0}', embed = discord.Embed(title=f'ASCII for {msg0}',
@ -74,7 +74,7 @@ class MorseCog(commands.Cog):
try: try:
cwChar = self.ascii2morse[char].replace('-', '==') cwChar = self.ascii2morse[char].replace('-', '==')
weight += len(cwChar) * 2 + 2 weight += len(cwChar) * 2 + 2
except: except KeyError:
res = f'Unknown character {char} in callsign' res = f'Unknown character {char} in callsign'
await ctx.send(res) await ctx.send(res)
return return