Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display error/warning for too large input #72 #168

Merged
merged 24 commits into from
Mar 22, 2019
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/popup/modules/UserInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,15 @@ const refreshQrCode = throttle(() => {
CommonMessages.hideError();
}

QrCreator.setTextInternal(text);
QrCreator.generate();
try {
QrCreator.setTextInternal(text);
QrCreator.generate();
} catch (e) {
if (e === "Data too long") {
rugk marked this conversation as resolved.
Show resolved Hide resolved
CommonMessages.showError("Cannot generate Qr Code, data size too big.");
ongspxm marked this conversation as resolved.
Show resolved Hide resolved
Logger.logError("Data exceeds maximum size:", text.length);
ongspxm marked this conversation as resolved.
Show resolved Hide resolved
}
rugk marked this conversation as resolved.
Show resolved Hide resolved
}
}, QR_CODE_REFRESH_TIMEOUT);

/**
Expand Down