mirror of
https://github.com/openharmony/third_party_qrcodegen.git
synced 2026-07-18 17:55:48 -04:00
Updated QrCode.encodeSegments() to throw DataTooLongException - in Java, C++, Python, Rust code. Rust code also changes return types from Option to Result. Updated Java and Rust documentation.
This commit is contained in:
+4
-1
@@ -124,7 +124,10 @@ class QrCode(object):
|
||||
if datausedbits is not None and datausedbits <= datacapacitybits:
|
||||
break # This version number is found to be suitable
|
||||
if version >= maxversion: # All versions in the range could not fit the given data
|
||||
raise ValueError("Data too long")
|
||||
msg = "Segment too long"
|
||||
if datausedbits is not None:
|
||||
msg = "Data length = {} bits, Max capacity = {} bits".format(datausedbits, datacapacitybits)
|
||||
raise DataTooLongError(msg)
|
||||
if datausedbits is None:
|
||||
raise AssertionError()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user