2.0 KiB
2.0 KiB
id, title, status, assignee, created_date, labels, dependencies, references, priority
| id | title | status | assignee | created_date | labels | dependencies | references | priority | |
|---|---|---|---|---|---|---|---|---|---|
| ML-33 | Align Last.fm callback errors with app conventions | Done | 2026-04-20 08:52 |
|
low |
Description
GitHub: created 2026-03-30 · updated 2026-03-30 · closed 2026-03-30
Summary
The Last.fm OAuth callback bypasses the project's standard user-facing error handling and interpolates raw failure reasons directly into the flash message.
Why This Matters
This is inconsistent with the documented convention for user-facing errors and increases the chance of exposing low-quality or overly-technical error text to users.
Evidence
MusicLibraryWeb.LastFmController.callback/2usesput_toast(:error, "Failed to connect your Last.fm account: #{reason}").- Project conventions say user-facing error reasons should go through
ErrorMessages.friendly_message/1instead of raw inspection/interpolation. - The current test only checks the flash prefix, so the inconsistency is not exercised.
Affected Files
lib/music_library_web/controllers/last_fm_controller.exdocs/project-conventions.mdtest/music_library_web/controllers/last_fm_controller_test.exs
Suggested Fix
Align the controller with the established convention: keep the contextual prefix, translate the reason through ErrorMessages.friendly_message/1, ensure the resulting string remains wrapped appropriately for localization/user display.
Acceptance Criteria
- The Last.fm callback uses the same user-facing error formatting approach as the rest of the app.
- Tests assert the controller does not expose raw backend error terms in the flash.
- #1 The Last.fm callback uses the same user-facing error formatting approach as the rest of the app.
- #2 Tests assert the controller does not expose raw backend error terms in the flash.