Enhance health activity error handling: Implement detailed error responses in FalukantController for 'tooClose' scenarios, including retry timing. Update localization files for improved user feedback on health measures and errors. Refactor error handling in HealthView to display appropriate messages based on error responses.

This commit is contained in:
Torsten Schulz (local)
2026-01-28 13:34:42 +01:00
parent 08b6437a1e
commit d4fb2a8ccc
5 changed files with 64 additions and 7 deletions

View File

@@ -142,9 +142,23 @@ export default {
this.selectedTr = '';
} catch (err) {
console.error('Error performing measure', err);
const title = this.$t('falukant.healthview.title');
const remoteMsg = err?.response?.data?.error || err?.message || String(err);
this.$root.$refs.messageDialog?.open(remoteMsg, title);
if (err?.response?.status === 412) {
const retryAtIso = err.response?.data?.retryAt;
const code = err.response?.data?.error || err.response?.data?.message;
if (retryAtIso) {
const retryStr = new Date(retryAtIso).toLocaleString(navigator.language, {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit'
});
const baseMsg = this.$t(`falukant.healthview.errors.${code}`);
this.$root.$refs.errorDialog?.open(`${baseMsg}${this.$t('falukant.healthview.nextMeasureAt')}: ${retryStr}`);
} else {
this.$root.$refs.errorDialog?.open(this.$t(`falukant.healthview.errors.${code}`));
}
} else {
const code = err?.response?.data?.error || err?.message || 'generic';
this.$root.$refs.errorDialog?.open(this.$t(`falukant.healthview.errors.${code}`) || this.$t('falukant.healthview.errors.generic'));
}
}
},
handleDaemonMessage(evt) {