Skip to content

Commit f88fa0e

Browse files
maresbWhyNotHugo
authored andcommitted
Raise a runtime error when converting missing character
I'm not 100% sure this is correct, but I think a None value would lead to an error later on anyways.
1 parent 6e14fe7 commit f88fa0e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

barcode/codex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ def _convert(self, char):
211211
value = int(self._buffer)
212212
self._buffer = ""
213213
return value
214-
return None
215-
return None
216-
return None
214+
raise RuntimeError(
215+
f"Character {char} could not be converted in charset {self._charset}."
216+
)
217217

218218
def _try_to_optimize(self, encoded):
219219
if encoded[1] in code128.TO:

0 commit comments

Comments
 (0)