Skip to content

feat(error-handling): generalize snack error with fallback#176

Merged
flomillot merged 2 commits into
mainfrom
feat/snack-with-fallback
May 13, 2026
Merged

feat(error-handling): generalize snack error with fallback#176
flomillot merged 2 commits into
mainfrom
feat/snack-with-fallback

Conversation

@flomillot
Copy link
Copy Markdown
Contributor

@flomillot flomillot commented May 12, 2026

Summary

Notes

  • For announcement errors, we use new server errors, more complete
image - In add dialogs (`add-user`/`add-group`/`add-profile`), the previously-ignored `_error` is now wired into `snackWithFallback` so server-side reasons reach the user.

Replace `snackError({ messageTxt: error.message, ... })` patterns with
`snackWithFallback(snackError, error, { ... })` so that structured errors
(ProblemDetailError, NetworkTimeoutError) raised by backendFetch are
surfaced with their business code / technical details, while plain
errors keep the previous behavior via catchErrorHandler.

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Error handling across thirteen UI components has been unified to use a snackWithFallback() utility from @gridsuite/commons-ui. Direct calls to snackError({ messageTxt: error.message, headerId }) have been replaced with snackWithFallback(snackError, error, { headerId }), delegating error message derivation to the centralized utility while preserving header identifiers.

Changes

Error handling unification using snackWithFallback

Layer / File(s) Summary
App and grid error handling
src/components/App/App.tsx, src/components/Grid/GridTable.tsx
App config parameter fetch and grid data loading errors now use snackWithFallback(snackError, error, { headerId }) for consistent error notification instead of inline snackError({ messageTxt: error.message, ... }) calls.
Parameter update error handling
src/components/parameters.tsx
Parameter update failures delegated to snackWithFallback to standardize error message handling.
Announcements error handling
src/pages/announcements/add-announcement-form.tsx, src/pages/announcements/announcements-page.tsx
Announcement creation and list-fetch errors refactored to use snackWithFallback for unified error notification across the announcements feature.
Groups management error handling
src/pages/groups/add-group-dialog.tsx, src/pages/groups/groups-table.tsx, src/pages/groups/modification/group-modification-dialog.tsx
Group creation, deletion, and modification error paths unified to delegate error handling to snackWithFallback instead of inline error construction.
Profiles management error handling
src/pages/profiles/add-profile-dialog.tsx, src/pages/profiles/modification/profile-modification-dialog.tsx, src/pages/profiles/profiles-table.tsx
Profile creation, read, modification, and deletion error paths refactored to use snackWithFallback for consistent error message derivation.
Users management error handling
src/pages/users/add-user-dialog.tsx, src/pages/users/modification/user-modification-dialog.tsx, src/pages/users/users-table.tsx
User creation, modification, and deletion error paths unified, including profile/group fetch failures, to use snackWithFallback for standardized error notification.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(error-handling): generalize snack error with fallback' accurately and concisely summarizes the main objective of the pull request: replacing direct snackError calls with a generalized snackWithFallback wrapper across the application.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly explains the purpose of the changes: replacing snackError patterns with snackWithFallback to surface structured errors with business codes and technical details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

… of snackWithFallback

Remove handleAnnouncementCreationErrors and its dedicated translation keys
since snackWithFallback now covers these cases generically.

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
@sonarqubecloud
Copy link
Copy Markdown

@flomillot flomillot merged commit b5f6b3b into main May 13, 2026
6 checks passed
@flomillot flomillot deleted the feat/snack-with-fallback branch May 13, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants