mirror of
https://github.com/block/buzz.git
synced 2026-11-26 11:12:22 +00:00
## Summary The compose bar's send error, the upload error and the invite page's error removed the first `Exception: ` anywhere in an error's text, not just a leading one. A `TimeoutException` read "Timeout..." and a wrapped error lost part of its text. They now share the helper Add Members already uses: only a plain `Exception`'s leading prefix is removed, a relay rejection shows its message verbatim, a lost acknowledgement drops the prefix only from its cause, and named types such as `TimeoutException` keep their whole name. The helper moves to `shared/relay/relay_error_text.dart`; Add Members behaves as before. ## Validation - New `relay_error_text_test.dart` covers a plain `Exception`, a `TimeoutException`, a named error whose message contains `Exception: `, a relay rejection and a lost acknowledgement. The `TimeoutException` and named-error rows fail with the old `replaceFirst`. No screenshots: the change only affects text after a failed send, upload or invite, which can't be triggered on demand against a real relay. Full-app run on an iOS simulator (signed in, healthy relay): cold start and session restore, channel list, opening a channel, sending a message, the attachment button, Settings, and background then foreground. All passed with no new errors in the device log. The invite page isn't offered to the test account. --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
29 lines
854 B
Dart
29 lines
854 B
Dart
import 'dart:async';
|
|
|
|
import 'package:buzz/shared/relay/relay.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
for (final (error, text) in <(Object, String)>[
|
|
(Exception('Upload failed'), 'Upload failed'),
|
|
(
|
|
TimeoutException('Event abc not acknowledged within 0:00:10'),
|
|
'TimeoutException: Event abc not acknowledged within 0:00:10',
|
|
),
|
|
(StateError('Exception: kept'), 'Bad state: Exception: kept'),
|
|
(
|
|
const RelayEventRejectedException('restricted: guests'),
|
|
'restricted: guests',
|
|
),
|
|
(
|
|
RelayAckLostError(Exception('App moved to background')),
|
|
'Connection lost before the relay acknowledged the event: '
|
|
'App moved to background',
|
|
),
|
|
]) {
|
|
test('shows ${error.runtimeType} as "$text"', () {
|
|
expect(relayErrorText(error), text);
|
|
});
|
|
}
|
|
}
|