Skip to content

Commit beab853

Browse files
committed
Use ValueError instead of Exception
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
1 parent eb4100e commit beab853

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/saml2/sigver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def split_len(seq, length):
357357

358358
def to_time(_time):
359359
if not _time.endswith(' GMT'):
360-
raise Exception('Time does not end with GMT')
360+
raise ValueError('Time does not end with GMT')
361361
_time = _time[:-4]
362362
return mktime(str_to_time(_time, M2_TIME_FORMAT))
363363

src/saml2/time_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def parse_duration(duration):
6868
else:
6969
sign = '+'
7070
if duration[index] != "P":
71-
raise Exception('Parse Duration is not valid.')
71+
raise ValueError('Parse Duration is not valid.')
7272
index += 1
7373

7474
dic = dict([(typ, 0) for (code, typ) in D_FORMAT if typ])
@@ -77,14 +77,14 @@ def parse_duration(duration):
7777
for code, typ in D_FORMAT:
7878
#print(duration[index:], code)
7979
if duration[index] == '-':
80-
raise Exception("Negation not allowed on individual items")
80+
raise ValueError("Negation not allowed on individual items")
8181
if code == "T":
8282
if duration[index] == "T":
8383
index += 1
8484
if index == len(duration):
85-
raise Exception("Not allowed to end with 'T'")
85+
raise ValueError("Not allowed to end with 'T'")
8686
else:
87-
raise Exception("Missing T")
87+
raise ValueError("Missing T")
8888
elif duration[index] == "T":
8989
continue
9090
else:

0 commit comments

Comments
 (0)