How to display a plugin error to the user?

When building a plugin, how do I show errors to the user?

At the moment I’m using this:

if (variable_that_equates_to_true) {
    throw new Error(
        "Error text goes here"
    );
}

But it just prints the error to the console. I want it to display as an alert (or something similar) to the user.

Bubble shows errors in alert messages for a myriad of other things. Is there anyway to hook into that?

1 Like

@Minty did you ever solve this?

Bubble allows you to do this:

Thanks @tylerboodman, was more thinking of using the window.alert() function in the JavaScript server side action to display a custom error/alert to the browser.

I’m guessing it’s not possible if the plugin action is server side.

Where you are writing this code in the “action” or “element” tab?

Ankur@ Nocodetalks
Looking for a Bubble Coach? Check out here

Its in the action tab, server-side. I’ve posed the question to Bubble to see if they can enlighten us.