Is it possible to leverage Grafana error message infra for a plugin?

If there is something wrong in the code of my plugin (ie. an exception is raised), grafana would display a red triangle in the upper left corner. I have the impression that it can also display a warning message.
I’m wondering if there is a way to leverage that in my plugin so that I could show custom error or warning messages.

Hi @matgrafana, you absolutely can.

If you throw an error in your plugin, Grafana will automatically display that in the UI as you mentioned.


throw new Error('This message will be displayed in the UI');

You can read the Error Handling documentation here.