Skip to content

Commit

Permalink
raise exceptions instead of return exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sail338 committed Jul 12, 2018
1 parent 8becc8e commit 3c6a908
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions garfield/lookup/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def index(request):
message = str(e.message)
response.message(message)
return response
if(parsed_data == {}):
message += "Contact is not in the System"
else:
message += "Number of Texts: %d\n" % (parsed_data['num_texts'])
except Contact.DoesNotExist as contacexp:
response.message("Contact was not found")
return response
message += "Number of Texts: %d\n" % (parsed_data['num_texts'])

message += "Number of Calls: %d\n"% (parsed_data['num_calls'])
message += "Number of Calls: %d\n"% (parsed_data['num_calls'])

message += "Number of Contacts Corresponded With: %d\n"% (parsed_data['suspect_contact_count'])
if parsed_data['suspect_carrier'] != None:
message += "Carrier: " + parsed_data['suspect_carrier']
message += "Number of Contacts Corresponded With: %d\n"% (parsed_data['suspect_contact_count'])
if parsed_data['suspect_carrier'] != None:
message += "Carrier: " + parsed_data['suspect_carrier']
response.message(message)
return response

Expand Down Expand Up @@ -74,7 +74,7 @@ def lookup_contact(request):
suspect_information['suspect_contact_count'] = suspect_contact_count
suspect_information['suspect_carrier'] = suspect_carrier
except:
Contact.DoesNotExist
raise Contact.DoesNotExist
return (suspect_information)

class Error(Exception):
Expand All @@ -90,7 +90,7 @@ def is_valid_number(number:str):
try:
return phonenumbers.is_possible_number(phnumber)
except Exception as e:
return e
raise e



0 comments on commit 3c6a908

Please sign in to comment.