From f87594e7af3bfd5cab7fa6c357280502d87ad112 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Fri, 1 Dec 2023 02:31:49 +0000 Subject: [PATCH] Hide error from CSM if it's uncalibrated The error still appears in the console - should be fixed eventually. --- .../modalComponents/calibrationModal.vue | 15 ++++++--------- webapp/src/main.js | 5 +++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/webapp/src/components/modalComponents/calibrationModal.vue b/webapp/src/components/modalComponents/calibrationModal.vue index 71380f36..7529b6b5 100644 --- a/webapp/src/components/modalComponents/calibrationModal.vue +++ b/webapp/src/components/modalComponents/calibrationModal.vue @@ -201,15 +201,12 @@ export default { show: async function() { // Check if the camera and stage are calibrated, if they can be if (this.canCSMCalibrated) { - try { - let csm = this.readThingProperty( - "camera_stage_mapping", - "image_to_stage_displacement_matrix" - ); - this.isCSMCalibrated = Boolean(csm); - } catch { - this.isCSMCalibrated = false; - } + let csm = this.readThingProperty( + "camera_stage_mapping", + "image_to_stage_displacement_matrix", + true + ); + this.isCSMCalibrated = Boolean(csm); } if (this.canLSTCalibrated) { this.isLSTCalibrated = this.readThingProperty( diff --git a/webapp/src/main.js b/webapp/src/main.js index 4dd2b266..8f71eba9 100644 --- a/webapp/src/main.js +++ b/webapp/src/main.js @@ -41,7 +41,7 @@ Vue.mixin({ thingAvailable(thing) { return this.$store.getters["wot/thingAvailable"](thing); }, - async readThingProperty(thing, property) { + async readThingProperty(thing, property, silence_errors = false) { let url = this.$store.getters["wot/thingPropertyUrl"]( thing, property, @@ -51,7 +51,8 @@ Vue.mixin({ let response = await axios.get(url); return response.data; } catch (error) { - this.modalError(error); + if (!silence_errors) this.modalError(error); + return undefined; } }, async writeThingProperty(thing, property, value) {