Custom error messages

by ten_6044
See Code Download Embed
I've made a block to create custom error messages. This block will allow you to create custom error messages from JavaScript, such as "SyntaxError", "TypeError", etc. instead of the generic "Hmm..." error messages. This is useful for projects that require more debugging or using lots of error messages. See code for examples!

How to use this block:
1. Drag the "throw _ _" block from the palette. It is found in the Control category.
2. Select the error type in the drop down.
3. Specify an error message.
4. Run the block, and you'll get an error with that type instead of the generic "Hmm..." error, with the specified message.

Note: This block uses JavaScript extensions, which have to be enabled first by seeing code, choose the gear icon at the top, then choose the option to enable JavaScript extensions.

Nov 9, 2022 -- You can now place a custom error type by typing in, and added "Error" into the dropdown menu, which does not require JS.

Created November 1, 2022

Last updated November 9, 2022

Published November 1, 2022