From a09817a975b950b7fe0f4e7b5f29bf68d9f28e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Wed, 13 May 2026 18:37:50 +0200 Subject: [PATCH] added verbose error body in case of errors --- lib/api/marianumcloud/talk/talk_api.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/api/marianumcloud/talk/talk_api.dart b/lib/api/marianumcloud/talk/talk_api.dart index b461221..59e6d3d 100644 --- a/lib/api/marianumcloud/talk/talk_api.dart +++ b/lib/api/marianumcloud/talk/talk_api.dart @@ -60,7 +60,15 @@ abstract class TalkApi extends ApiRequest { final status = data.statusCode; if (status < 200 || status >= 300) { - final detail = 'Talk $endpoint -> HTTP $status'; + // Talk's OCS errors put the real reason in the response body (e.g. + // expired session, removed participant, malformed reply target). + // Include a trimmed preview so the in-app error dialog and logs + // surface the cause instead of just the bare status code. + final body = data.body.replaceAll(RegExp(r'\s+'), ' ').trim(); + final preview = body.length > 500 ? '${body.substring(0, 500)}…' : body; + final detail = body.isEmpty + ? 'Talk $endpoint -> HTTP $status' + : 'Talk $endpoint -> HTTP $status body=$preview'; log(detail); if (status == 401) { throw AuthException.unauthorized(technicalDetails: detail);