How to trap an error from a custom integration to trigger an alert

Hi,

I have recently experienced errors with a custom integration. While I debug this it made me consider how to trap an occurrence of the error and trigger an action (e.g. send a message). The error with the integration is visible in the log and clearly linked to the integration.

Logger: custom_components.rako.light
Source: custom_components/rako/light.py:126
Integration: Rako
First occurred: 7:12:02 PM (1 occurrences)
Last logged: 7:12:02 PM

An error occurred while updating the Rako Light

Is there a straightforward way to trap this? I generally use node red for automations and alerts.

Many thanks,

Tom