Error Surfacing#1091
Conversation
| return code_response(ctrl, ctrl.play_media(media)) | ||
|
|
||
|
|
||
| @api.patch("/api/alert/hide") |
There was a problem hiding this comment.
This pathing might need some work. It made more sense when I had multiple alert endpoints being added here but I found 2/3 of the endpoints didn't make sense as I kept devving on this
| class AlertLevel(Enum): | ||
| WARNING = "warning" | ||
| ERROR = "error" | ||
| INFO = "info" | ||
| SUCCESS = "success" | ||
|
|
||
|
|
||
| class Alert(BaseModel): | ||
| message: str | ||
| severity: AlertLevel = AlertLevel.ERROR | ||
| """What color should the alert be as per the Mui style guide: https://mui.com/material-ui/react-alert/#severity""" |
There was a problem hiding this comment.
The docstring under the severity var would probably also make sense as a docstring for the AlertLevel
| selected_alert.hidden = True | ||
| save_alerts(alerts) | ||
| else: | ||
| add_alert("Alert not found, could not be hidden!") |
There was a problem hiding this comment.
This probably makes sense as an Exception as well
There was a problem hiding this comment.
The MUI alert component that we use has a "severity" property that has 4 possible values - error, success, warning, and info. I have had no particular use for warning and info thus far, so I flattened it into just success or error. Within that, I generally only needed error so I had it be a store_true arg for whether it shows success or fail, I've upgraded that with full granularity to future proof these changes.
Luckily the other two AlertBar style components we use don't have the same controls so I didn't need to upkeep those for full feature parity in this PR
What does this change intend to accomplish?
Surface backend errors to users better
Also mitigate some minor issues that required surfacing
Checklist
./scripts/test