Attention is currently required from: dexter.
laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37839?usp=email )
Change subject: pySim-shell: prevent opening/closing logical channel 0 ......................................................................
Patch Set 1:
(1 comment)
File pySim-shell.py:
https://gerrit.osmocom.org/c/pysim/+/37839/comment/31ffa4e8_7065ba14?usp=ema... : PS1, Line 974: raise RuntimeError("Cannot create (always existing) basic logical lchan 0") Id'd have assumed raising a ValueError is more correct, as it's a wrong value. We might also handle this already at the argparse level by introducig a more specific 'type' than 'int'. This is what we do in the type=is_hexstr case.
We could have a is_lchan_nr method which checks for a valid number (not zero, not too high).
Handling those kind of things in argparse is more elegant, IMHO. It avoids open-coding checks all over the code.