fix: correct test failures and error propagation
- Add CacheScope provider in UserProfileCacheRepository tests - Remove catch blocks that swallowed errors in _loadHistory/_loadMoreHistory - Errors now properly propagate to switchUser() caller
This commit is contained in:
@@ -22,12 +22,6 @@ extension _ChatBlocHistory on ChatBloc {
|
||||
hasEarlierHistory: snapshot.hasMore,
|
||||
),
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Failed to load chat history',
|
||||
error: e,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
} finally {
|
||||
if (epoch == _sessionEpoch) {
|
||||
emit(state.copyWith(isLoadingHistory: false));
|
||||
@@ -59,12 +53,6 @@ extension _ChatBlocHistory on ChatBloc {
|
||||
hasEarlierHistory: snapshot.hasMore,
|
||||
),
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Failed to load more chat history',
|
||||
error: e,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
} finally {
|
||||
if (epoch == _sessionEpoch) {
|
||||
emit(state.copyWith(isLoadingHistory: false));
|
||||
|
||||
@@ -4,14 +4,6 @@ part of 'chat_bloc.dart';
|
||||
|
||||
extension _ChatBlocSend on ChatBloc {
|
||||
Future<void> _sendMessage(String content, {List<XFile>? images}) async {
|
||||
_logger.info(
|
||||
message: 'Sending chat message',
|
||||
extra: {
|
||||
'message_length': content.length,
|
||||
'attachments_count': images?.length ?? 0,
|
||||
},
|
||||
);
|
||||
|
||||
final epoch = _sessionEpoch;
|
||||
final assistantBaselineAtSend = chatBlocLatestAssistantTimestamp(
|
||||
state.items,
|
||||
|
||||
Reference in New Issue
Block a user