Recommend way to send errors back to user?

I am curious on recommended way(s) to send an error back to the user. The condition I am working with currently is verify data in a javascript query. If there is something incorrect (e.g. missing id), I want to stop processing, and throw up a model or alert indicating error condition, resolution, etc.
Suggestions? Thank you.

I would like to throw my own error and details

I see. There's a decent example of this here in our docs. Does this help?
https://docs.retool.com/docs/scripting-retool#section-3-add-a-button-and-make-it-execute-query-1-for-each-row-in-the-csv
Also I would point out the function utils.showNotification() which an be used to send notifications to users.

Yeah, it looks like that will take care of it. That was sure buried in the docs.

Indeed it is… we’re going to be improving the docs over the next few weeks. Stay tuned!