automate: make automation failure message friendlier

This commit is contained in:
Iain Learmonth 2022-06-18 14:16:38 +01:00
parent 7ceca2ace2
commit 281fe905bd

View file

@ -121,7 +121,10 @@ def run_job(job_cls: Type[BaseAutomation], *,
db.session.add(log)
activity = Activity(
activity_type="automation",
text=f"FLASH! Automation Failure: {automation.short_name}. See logs for details."
text=(f"[{automation.short_name}] 🚨 Automation failure: It was not possible to handle this failure safely "
"and so the automation task has been automatically disabled. It may be possible to simply re-enable "
"the task, but repeated failures will usually require deeper investigation. See logs for full "
"details.")
)
db.session.add(activity)
activity.notify() # Notify before commit because the failure occurred even if we can't commit.