NaturalHistoryMuseum / pylibdmtx

Read Data Matrix barcodes from Python 2 and 3.
MIT License
147 stars 56 forks source link

Error message for empty input for `encode` could be more specific #81

Open sumpfralle opened 2 years ago

sumpfralle commented 2 years ago

Currently empty input for the encode function is answered with the following error message:

$ python3 -c "from pylibdmtx.pylibdmtx import encode; encode(b'')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/pylibdmtx/pylibdmtx.py", line 359, in encode
    raise PyLibDMTXError(
pylibdmtx.pylibdmtx_error.PyLibDMTXError: Could not encode data, possibly because the image is not large enough to contain the data

A more specific error message could be more helpful in order to understand the problem, e.g.:

Could not encode data, since empty input is not supported.

Thank you for your time!