Skip to content

Commit adb555a

Browse files
authored
Change exception type from TypeError to ValueError; check for negative total_len
1 parent 008b548 commit adb555a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_atecc/adafruit_atecc_asn1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def issuer_or_subject_length(
252252
:param str org: Organization of certificate
253253
:param str org_unit: Organization unit of certificate
254254
:param str common: Common data of certificate
255-
:raises: TypeError if return value is 0
255+
:raises: ValueError if return value is <= 0
256256
:return: Total length of provided certificate information.
257257
"""
258258
tot_len = 0
@@ -269,6 +269,6 @@ def issuer_or_subject_length(
269269
if common:
270270
tot_len += 11 + len(common)
271271

272-
if not tot_len:
273-
raise TypeError("Provided length must be > 0")
272+
if tot_len <= 0:
273+
raise ValueError("Provided length must be > 0")
274274
return tot_len

0 commit comments

Comments
 (0)