From 647d93a1dc0edd190bc077d15f1988ffad6319e2 Mon Sep 17 00:00:00 2001 From: flemming-it Date: Sat, 30 May 2026 01:19:13 +0200 Subject: [PATCH] =?UTF-8?q?fix(studio):=20editor=20=E2=80=94=20friendly-er?= =?UTF-8?q?ror=20mapping=20for=20run=20failures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously a failed runSavedFlow dumped the raw exception into FaiErrorBox in the right panel. Hub gRPC failures (network, missing module, schema reject, …) are now mapped through friendlyError so the operator sees a one-sentence headline + optional recovery hint, with the verbatim error still accessible behind FaiErrorBox's expand-on-tap. Matches the same pattern already used by every other Studio page that surfaces a hub error. Signed-off-by: flemming-it --- lib/pages/flow_editor.dart | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/lib/pages/flow_editor.dart b/lib/pages/flow_editor.dart index ca45628..af0e2f3 100644 --- a/lib/pages/flow_editor.dart +++ b/lib/pages/flow_editor.dart @@ -639,9 +639,41 @@ class _RunResult extends StatelessWidget { ), const SizedBox(height: FaiSpace.sm), if (running) const LinearProgressIndicator(), - if (error != null) - FaiErrorBox(error: error, isError: true) - else if (outputs != null) + if (error != null) ...[ + // Map raw exceptions through friendlyError so the + // operator sees a sentence + a recovery hint + // instead of a stack trace. The verbatim error + // stays accessible via FaiErrorBox's expand-on-tap. + Builder( + builder: (ctx) { + final fe = friendlyError(error!, l); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + fe.headline, + style: Theme.of(ctx).textTheme.bodyMedium?.copyWith( + color: Theme.of(ctx).colorScheme.error, + ), + ), + if (fe.hint != null) ...[ + const SizedBox(height: FaiSpace.xs), + Text( + fe.hint!, + style: Theme.of(ctx).textTheme.bodySmall, + ), + ], + const SizedBox(height: FaiSpace.sm), + FaiErrorBox( + error: fe.detail, + isError: true, + maxHeight: 200, + ), + ], + ); + }, + ), + ] else if (outputs != null) Expanded( child: ListView( children: [