Skip to content

Error Surfacing#1091

Draft
SteveMicroNova wants to merge 1 commit into
VersionWarningfrom
ResetOnFailure
Draft

Error Surfacing#1091
SteveMicroNova wants to merge 1 commit into
VersionWarningfrom
ResetOnFailure

Conversation

@SteveMicroNova
Copy link
Copy Markdown
Contributor

What does this change intend to accomplish?

Surface backend errors to users better

Also mitigate some minor issues that required surfacing

Checklist

  • Have you tested your changes and ensured they work?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • If applicable, have you updated the documentation/manual?
  • If applicable, have you updated the CHANGELOG?
  • Does your submission pass linting & tests? You can test on localhost using ./scripts/test
  • Have you written new tests for your core features/changes, as applicable?
  • If this is a UI change, have you tested it across multiple browser platforms on both desktop and mobile?

@SteveMicroNova SteveMicroNova changed the base branch from main to VersionWarning May 26, 2026 20:47
Comment thread amplipi/app.py
return code_response(ctrl, ctrl.play_media(media))


@api.patch("/api/alert/hide")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread amplipi/models.py
Comment on lines +1008 to +1018
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"""
Copy link
Copy Markdown
Contributor Author

@SteveMicroNova SteveMicroNova May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring under the severity var would probably also make sense as a docstring for the AlertLevel

Comment thread amplipi/utils.py
selected_alert.hidden = True
save_alerts(alerts)
else:
add_alert("Alert not found, could not be hidden!")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably makes sense as an Exception as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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.

1 participant