Skip to content

Commit

Permalink
avoid accidental exception raise
Browse files Browse the repository at this point in the history
  • Loading branch information
Omicron166 committed Mar 6, 2022
1 parent 4e92024 commit c303d90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clients/python/lns.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ def __init__(self, server: str):
def resolve(self, name: str):
try:
r = requests.get(self.server + '/records/' + name + '.json')
if r.status_code != 200: raise NameNotFound()
except: raise NameNotFound('The record does not exist')
if r.status_code != 200: raise NameNotFound('The record does not exist')

try: return r.json()['record']['link']
except: raise NameNotFound('The record format is invalid')

def dig(self, name: str):
try:
if r.status_code != 200: raise Exception()
r = requests.get(self.server + '/records/' + name + '.json')
except: raise NameNotFound('The record does not exist')
if r.status_code != 200: raise NameNotFound('The record does not exist')

try: return r.json()
except: raise NameNotFound('The record format is invalid')

0 comments on commit c303d90

Please sign in to comment.