It’s not so much a question of “don’t like it” as “it does not achieve the desired result”.
Both error and error.message produces the undesired verbosity, but they’re slightly different.
error: AxiosError: Request failed with status code 404
error.message: Error: Request failed with status code 404
However, it occurred to me late last night that maybe I’m trying to suppress the verbosity the wrong way.
My initial thought was to suppress the verbosity that comes “from” the plugin error, by editing the code within the plugin, but it seems as if that verbosity is inserted by Bubble after receiving the error from the plugin.
And from a diagnostic perspective, that detail may be useful to someone at Bubble troubleshooting any issue that may be occurring.
I just don’t want my users to see it.
So… late last night it occurred to me that since the message I want to show is on a line all by itself, maybe I can use a RegularExpression to “filter in” only that one line.
And that worked.
So I put the catch code back to this:
catch (error) {
callback(error.message)
}
Which produced this very verbose this:
Until I ran it though a RegEx on the front end, like this:
And now, what my users will see is:
So, I thank everyone for their input. I learned a few things.
But this turned out to be a case of there being more than one way to achieve a desired result.