domain: MicropubError::InsufficientScope carries a string where the Scope enum exists #71
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rosa/vernier#71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found during a code review of the
domaincrate.Location:
crates/domain/src/errors.rs:92; call sitesservices.rs:494/552/576Type: Cleanup / altitude — stringly-typed data
Problem
MicropubError::InsufficientScope(&static str)carries a bare string literal ("create"/"delete"/"update") even though theScopeenum with those variants andas_str()already exists.Cost
A typo (e.g. "crate") compiles fine and produces a wrong error message and wrong WWW-Authenticate/JSON scope hint, and the adapter must string-compare to know which scope was missing.
Suggested fix
Change to
InsufficientScope(Scope)and let the Display impl derive the wire string.