Reporting/Calling an error

How do I report/call an error?

What do I need this for?
I need this for forbidden string values in my custom blocks. It would be handy so that there are no broken variables and such.

catch errors in script library. How to get it? file > libraries > catch errors in script. the throw [] block sends an error.

In the JavaScript function block's body, put throw new Error("my error message"), then run or call it.