Skip to content

Commit 294dc90

Browse files
committed
handles error with json parsing
1 parent 6fed1f0 commit 294dc90

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

services/static-webserver/client/source/class/osparc/po/PreRegistration.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@ qx.Class.define("osparc.po.PreRegistration", {
7878
submitBtn.setFetching(true);
7979
const findingStatus = this.getChildControl("finding-status");
8080
findingStatus.setValue(this.tr("Searching Pre-Registered users..."));
81+
try {
82+
const preData = JSON.parse(requestAccountData.getValue())
83+
} catch (error) {
84+
console.error(`Cannot parse pre-registration JSON data: ${preData}:`, error)
85+
osparc.FlashMessenger.logAs("Invalid JSON in Pre-Registration input", "ERROR");
86+
}
8187
const params = {
82-
data: JSON.parse(requestAccountData.getValue())
88+
data: preData
8389
};
8490
osparc.data.Resources.fetch("users", "preRegister", params)
8591
.then(data => {

0 commit comments

Comments
 (0)