laforge has uploaded this change for review.

View Change

osmo-smdpp: Proper error handling in case ctxParams1 is missing member

************* Module osmo-smdpp
osmo-smdpp.py:373:15: E0601: Using variable 'iccid_str' before assignment (used-before-assignment)

Change-Id: I52bef18cbcc9f5d14519ff1473532c8502d45908
---
M osmo-smdpp.py
1 file changed, 3 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/55/37855/1
diff --git a/osmo-smdpp.py b/osmo-smdpp.py
index a044b9b..3dbe9b1 100755
--- a/osmo-smdpp.py
+++ b/osmo-smdpp.py
@@ -368,9 +368,9 @@
with open(path, 'rb') as f:
pes = saip.ProfileElementSequence.from_der(f.read())
iccid_str = b2h(pes.get_pe_for_type('header').decoded['iccid'])
-
- # make pylint happy: E0601: Using variable 'iccid_str' before assignment (used-before-assignment)
- assert iccid_str
+ else:
+ # there's currently no other option in the ctxParams1 choice, so this cannot happen
+ raise ApiError('1.3.1', '2.2', 'ctxParams1 missing mandatory ctxParamsForCommonAuthentication')

# FIXME: we actually want to perform the profile binding herr, and read the profile metadat from the profile


To view, visit change 37855. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I52bef18cbcc9f5d14519ff1473532c8502d45908
Gerrit-Change-Number: 37855
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>