Alerting before Workflow Fails

Hello, before the workflow fails due to some exception we need to raise an alert in the dashboard. Next action will be taken depends on the alert raised. Can u suggest suitable way or just catch the exception and raise an alert and throw the error again