-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add translation error handling #516
feat: add translation error handling #516
Conversation
📝 Walkthrough📝 WalkthroughWalkthrough이 변경 사항은 Changes
Possibly related issues
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
lib/app/modules/notices/presentation/pages/notice_edit_body_page.dart (1)
284-307
: 오류 처리 구현이 개선되었습니다.번역 기능의 오류 처리가 체계적으로 구현되었습니다. 다만 몇 가지 개선 사항을 제안드립니다:
- 일반적인 예외 메시지는 사용자가 이해하기 어려울 수 있습니다. 사용자 친화적인 오류 메시지를 표시하는 것이 좋겠습니다.
- 오류가 발생했을 때 분석 이벤트를 추가하면 문제 추적에 도움이 될 것 같습니다.
다음과 같이 개선하는 것을 제안드립니다:
try { final bloc = context.read<AiBloc>(); final blocker = bloc.stream.firstWhere((s) => s.hasResult); bloc.add(AiEvent.request( body: _koreanBodyController.html, lang: Language.en, )); final result = await blocker; if (!mounted) return; result.mapOrNull( loaded: (result) { AnalyticsRepository.action( const AnalyticsEvent.noticeEditBodyUseAiTranslation()); return _englishBodyController.html = result.body; }, error: (error) { context.showToast(error.message); + AnalyticsRepository.error( + const AnalyticsEvent.noticeEditBodyTranslationError()); }, ); } catch (e) { if (mounted) { - context.showToast(e.toString()); + context.showToast(context.t.notice.translation.error); + AnalyticsRepository.error( + const AnalyticsEvent.noticeEditBodyTranslationError()); } }lib/app/modules/notices/presentation/pages/notice_write_body_page.dart (1)
332-350
: 기본적인 오류 처리가 잘 구현되었습니다.오류 처리 로직이 추가되어 사용자 경험이 개선되었습니다. 다만 다음과 같은 개선사항을 제안드립니다:
- 구체적인 예외 타입에 따른 처리
- 디버깅을 위한 로깅 추가
- 재시도 메커니즘 구현 검토
다음과 같이 개선해 보시는 것은 어떨까요:
Future<void> _translate() async { try { final bloc = context.read<AiBloc>(); final blocker = bloc.stream.firstWhere((s) => s.hasResult); bloc.add(AiEvent.request( body: _koreanBodyController.html, lang: Language.en, )); final result = await blocker; result.mapOrNull( loaded: (result) => _englishBodyController.html = result.body, error: (error) { + debugPrint('Translation error: ${error.message}'); context.showToast(error.message); }, ); } catch (e) { + debugPrint('Unexpected error during translation: $e'); if (mounted) { - context.showToast(e.toString()); + context.showToast(context.t.common.unexpectedError); } } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
lib/app/modules/notices/presentation/pages/notice_edit_body_page.dart
(1 hunks)lib/app/modules/notices/presentation/pages/notice_write_body_page.dart
(1 hunks)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try catch 로 에러가 나가진 않아요! mapOrNull해서 토스트만 띄워주면 충분!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
개취긴 한데.. ㅎㅎ
lib/app/modules/notices/presentation/pages/notice_edit_body_page.dart
Outdated
Show resolved
Hide resolved
이 PR에 4.1.4 로 버전 업그레이드 하는거 넣어주시구 머지 후에 배포해주세요! |
1efaf88
Summary by CodeRabbit
4.1.3
에서4.1.4
로 변경되었습니다.