Skip to content

Commit

Permalink
shift err messags to localized form
Browse files Browse the repository at this point in the history
  • Loading branch information
ongspxm committed Mar 10, 2019
1 parent 6a5ec8c commit 26e2503
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
"message": "Permission request failed.",
"description": "Error shown when a permission request failed. This indicates a technical error and does NOT mean the user declined the permission."
},
"errorQrCodeOverflow": {
"message": "Cannot generate QR Code, data size too big.",
"description": "Error shown when QR code cannot be generated due to overflow in input size."
},
"requestDownloadPermissionForQr": {
"message": "To continue to save the QR code, we need the download permission.",
"description": "Shown, when the user is asked to allow the download permission to save the QR code."
Expand Down
3 changes: 2 additions & 1 deletion src/popup/modules/UserInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ const refreshQrCode = throttle(() => {
QrCreator.setTextInternal(text);
QrCreator.generate();
} catch (e) {
// Error thrown from qrcodegen & kjua wrapper when code too long
if (e === "Data too long") {
CommonMessages.showError("Cannot generate Qr Code, data size too big.");
CommonMessages.showError("errorQrCodeOverflow", true);
Logger.logError("Data exceeds maximum size:", text.length);
} else {
throw e;
Expand Down

0 comments on commit 26e2503

Please sign in to comment.