fix: always show snackbar on 403 errors#113
Conversation
403 Forbidden errors now always display a snackbar notification so the user knows they lack permission. Previously, 403 errors were silently suppressed unless the caller explicitly passed notify=true. 404 errors remain silently handled by the UI (router redirect, v-alert) unless notify=true is explicitly passed.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/plugins/functions.ts (1)
193-196: Add regression tests for 403/404 notification matrix.Please add focused tests for
handleError/setErrorcovering: 403 +notifyundefined/false (snackbar shown), 404 +notifyfalse (silent), and 404 +notifytrue (snackbar shown).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/plugins/functions.ts` around lines 193 - 196, Add unit tests for the error-notification matrix targeting the functions handleError and setError: create three focused tests that assert snackbar notification behavior when (1) a 403 error occurs and notify is undefined/false -> snackbar shown, (2) a 404 error occurs and notify is false -> no snackbar, and (3) a 404 error occurs and notify is true -> snackbar shown. In each test, simulate the error payload (use a Response-like object or helper that triggers isNotFoundError for 404 and a 403 for forbidden), call handleError/setError with the appropriate notify value, and assert that the notification/snackbar stub or mock was invoked or not accordingly; reference the isNotFoundError predicate to ensure you supply the right error shape and stub the notification mechanism used by the code under test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/plugins/functions.ts`:
- Around line 193-196: Add unit tests for the error-notification matrix
targeting the functions handleError and setError: create three focused tests
that assert snackbar notification behavior when (1) a 403 error occurs and
notify is undefined/false -> snackbar shown, (2) a 404 error occurs and notify
is false -> no snackbar, and (3) a 404 error occurs and notify is true ->
snackbar shown. In each test, simulate the error payload (use a Response-like
object or helper that triggers isNotFoundError for 404 and a 403 for forbidden),
call handleError/setError with the appropriate notify value, and assert that the
notification/snackbar stub or mock was invoked or not accordingly; reference the
isNotFoundError predicate to ensure you supply the right error shape and stub
the notification mechanism used by the code under test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0f1d76c1-ce4c-4793-8951-bab4ddb0a3f6
📒 Files selected for processing (1)
src/plugins/functions.ts
403 Forbidden errors now always display a snackbar notification so the user knows they lack permission. Previously, 403 errors were silently suppressed unless the caller explicitly passed
notify=true.404 errors remain silently handled by the UI (router redirect, v-alert) unless
notify=trueis explicitly passed.This re-applies the fix from #112 (which was merged before CI completed and then reverted).
Summary by CodeRabbit
Release Notes