From bb3f0f3a03da99b4ba003d592a33df771df8ab98 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 3 Nov 2025 09:46:26 +0100 Subject: [PATCH] Enhance error handling in MyTischtennisUrlController and update TrainingStatsView with TTR and QTTR columns Improved error handling in MyTischtennisUrlController by adding detailed debug information in the response, including status codes and relevant data. Updated TrainingStatsView to display TTR and QTTR values for members, enhancing data visibility and user experience. --- .../controllers/myTischtennisUrlController.js | 17 ++++++++++++++++- frontend/src/views/TrainingStatsView.vue | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/backend/controllers/myTischtennisUrlController.js b/backend/controllers/myTischtennisUrlController.js index 88a22f1..1e2b627 100644 --- a/backend/controllers/myTischtennisUrlController.js +++ b/backend/controllers/myTischtennisUrlController.js @@ -419,7 +419,22 @@ class MyTischtennisUrlController { } } - next(error); + const status = error.statusCode || error.status || 500; + const debug = { + message: error.message || String(error), + name: error.name, + stack: (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'development') ? (error.stack || null) : undefined, + team: team ? { id: team.id, name: team.name } : null, + league: team && team.league ? { id: team.league.id, name: team.league.name, association: team.league.association, groupId: team.league.myTischtennisGroupId, groupname: team.league.groupname } : null, + url: typeof myTischtennisUrl !== 'undefined' ? myTischtennisUrl : null + }; + try { + res.status(status).json({ success: false, error: debug.message, debug }); + } catch (writeErr) { + // Fallback, falls Headers schon gesendet wurden + // eslint-disable-next-line no-console + console.error('[fetchTeamData] Response write failed:', writeErr); + } } } diff --git a/frontend/src/views/TrainingStatsView.vue b/frontend/src/views/TrainingStatsView.vue index 3d07f5c..5f63104 100644 --- a/frontend/src/views/TrainingStatsView.vue +++ b/frontend/src/views/TrainingStatsView.vue @@ -76,6 +76,8 @@ {{ getSortIcon('name') }} + TTR + QTTR Geburtsdatum
@@ -107,6 +109,8 @@ {{ member.firstName }} {{ member.lastName }} + {{ member.ttr ?? '–' }} + {{ member.qttr ?? '–' }} {{ formatBirthdate(member.birthDate) }} {{ member.participation12Months }} {{ member.participation3Months }}