Skip to content

Commit

Permalink
Improve missing post snackbar message (#1291)
Browse files Browse the repository at this point in the history
* Improve missing post message

* Fix arb file
  • Loading branch information
micahmo authored Apr 10, 2024
1 parent 78cce34 commit cece3b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@
"@couldNotDeterminePostComment": {},
"couldntCreateReport": "Your comment report could not be submitted at this time. Please try again later",
"@couldntCreateReport": {},
"couldntFindPost": "Unable to load the requested post. It may have been deleted or removed.",
"@couldntFindPost": {
"description": "Error message for when we can't load a post."
},
"countSubscribers": "{count} subscribers",
"@countSubscribers": {},
"countUsers": "{count} users",
Expand Down
2 changes: 1 addition & 1 deletion lib/post/bloc/post_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class PostBloc extends Bloc<PostEvent, PostState> {
attemptCount++;
}
}
emit(state.copyWith(status: PostStatus.failure, errorMessage: exception.toString()));
emit(state.copyWith(status: PostStatus.failure, errorMessage: getExceptionErrorMessage(exception)));
} catch (e) {
emit(state.copyWith(status: PostStatus.failure, errorMessage: e.toString()));
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils/error_messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ String? getErrorMessage(BuildContext context, String lemmyApiErrorCode, {String?
"language_not_allowed" => l10n.languageNotAllowed,
"couldnt_find_community" => additionalInfo != null ? l10n.unableToFindCommunityName(additionalInfo) : l10n.unableToFindCommunity,
"couldnt_find_person" => additionalInfo != null ? l10n.unableToFindUserName(additionalInfo) : l10n.unableToFindUser,
"couldnt_find_post" => l10n.couldntFindPost,
_ => lemmyApiErrorCode,
};
}

0 comments on commit cece3b1

Please sign in to comment.