If you prefer breakpoints, you can also use a assert method in the QM’s Scripting Console (see more details, for example, here). Arrange asserts in the right parts of the script. Run the script from the console. If assert will evaluate the variable to false, the script at this point will stop and display a message in the status line. Otherwise, the script will execute and display the result.
Below is the demonstration of two cases with simple example.
There is no error, take the result (4).
There is the error, the script is stopped. There is no result (4).