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

🐛[FrontEnd] Better error handling of invalid pre-registration data #6438

Merged
merged 11 commits into from
Sep 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,27 @@ qx.Class.define("osparc.po.PreRegistration", {
}
if (form.validate()) {
submitBtn.setFetching(true);

const flashErrorMsg = this.tr("Pre-Registration Failed. See details below");
pcrespov marked this conversation as resolved.
Show resolved Hide resolved
const findingStatus = this.getChildControl("finding-status");
pcrespov marked this conversation as resolved.
Show resolved Hide resolved
findingStatus.setValue(this.tr("Searching Pre-Registered users..."));
const params = {
data: JSON.parse(requestAccountData.getValue())
};

let params;
try {
params = {
data: JSON.parse(requestAccountData.getValue())
};
} catch (err) {
console.error(err);

const detailErrorMsg = `Error parsing Request Form JSON. ${err}`;
findingStatus.setValue(detailErrorMsg);

osparc.FlashMessenger.logAs(flashErrorMsg, "ERROR");
submitBtn.setFetching(false);
return
}

osparc.data.Resources.fetch("users", "preRegister", params)
.then(data => {
if (data.length) {
Expand All @@ -91,9 +107,10 @@ qx.Class.define("osparc.po.PreRegistration", {
this.__populatePreRegistrationLayout(data);
})
.catch(err => {
findingStatus.setValue(this.tr("Error searching Pre-Registered users"));
const detailErrorMsg = this.tr(`Error during Pre-Registeristration: ${err.message}`)
findingStatus.setValue(detailErrorMsg);
console.error(err);
osparc.FlashMessenger.logAs(err.message, "ERROR");
osparc.FlashMessenger.logAs(flashErrorMsg, "ERROR");
})
.finally(() => submitBtn.setFetching(false));
}
Expand Down
Loading