53a8f668ca
Native Run action opens the web's prompt/workspace/notify dialog, sends the exact run_pipeline body against the pinned resolved version with one request key per confirmed attempt, keeps refusals in the dialog, reconciles a lost reply by key, and opens only the server-named run through the existing run route with one fresh Runs list read. Adds a shared failure-reason helper so operators never see Dart runtime prefixes, and records the slice boundary in notes/P3-run.md.
27 lines
998 B
Dart
27 lines
998 B
Dart
/// The reason text carried by a failed request, without runtime diagnostics.
|
|
///
|
|
/// The gateway fails pending requests with `StateError('Connection closed')`,
|
|
/// whose `toString()` is `Bad state: Connection closed`. The browser shows the
|
|
/// reason itself, never a Dart diagnostic, so those prefixes are stripped while
|
|
/// deliberate protocol/refusal messages stay untouched. [fallback] is the
|
|
/// honest sentence for a failure that carries no text at all.
|
|
String describeErrorReason(
|
|
Object error, {
|
|
required String fallback,
|
|
}) {
|
|
final raw = switch (error) {
|
|
StateError(:final message) => message.toString(),
|
|
_ => '$error',
|
|
};
|
|
var message = raw.trim();
|
|
for (final prefix in _runtimePrefixes) {
|
|
if (message.startsWith(prefix)) {
|
|
message = message.substring(prefix.length).trim();
|
|
}
|
|
}
|
|
return message.isEmpty ? fallback : message;
|
|
}
|
|
|
|
/// Dart runtime prefixes that never belong in operator-facing copy.
|
|
const _runtimePrefixes = ['Bad state:', 'Exception:'];
|