Added new unused "data too long" exception/error class to Java, C++, Python, Rust code.

This commit is contained in:
Project Nayuki
2018-10-26 02:39:46 +00:00
parent 3da57e5aa0
commit 4635e8a8a8
5 changed files with 122 additions and 0 deletions
+4
View File
@@ -617,4 +617,8 @@ uint8_t QrCode::ReedSolomonGenerator::multiply(uint8_t x, uint8_t y) {
return static_cast<uint8_t>(z);
}
data_too_long::data_too_long(const std::string &msg) :
std::length_error(msg) {}
}
+21
View File
@@ -348,4 +348,25 @@ class QrCode final {
};
/*---- Public exception class ----*/
/*
* Thrown when the supplied data does not fit any QR Code version. Ways to handle this exception include:
* - Decrease the error correction level if it was greater than Ecc::LOW.
* - If the encodeSegments() function was called with a maxVersion argument, then increase
* it if it was less than QrCode::MAX_VERSION. (This advice does not apply to the other
* factory functions because they search all versions up to QrCode::MAX_VERSION.)
* - Split the text data into better or optimal segments in order to reduce the number of bits required.
* - Change the text or binary data to be shorter.
* - Change the text to fit the character set of a particular segment mode (e.g. alphanumeric).
* - Propagate the error upward to the caller/user.
*/
class data_too_long : public std::length_error {
public: explicit data_too_long(const std::string &msg);
};
}