What you're probably looking for are assertions, not exceptions.
In general, exceptions should be thrown when something bad is happening that you can't do anything about in the current code scope. For example, your function's purpose is to open a file, but the file specified in the function's parameter is not present on the storage medium.
Exceptions shouldn't be used as a generalized debug mechanism. If you want to know whether something is happening or not in a script, log it, capture the behavior in a unit test, or examine it using a debugger, rather than using an exception.
Exceptions signal something that you expect to happen, even though it's an error condition that you cannot do anything about. You might reasonably expect that someone will hand you the path to a file that does not exist. But that doesn't mean that your code is incorrect; it just means that the caller didn't provide adequate conditions to succeed.
Assertions are different; they signal a problem with your code. They are more semantically correct to use for debugging purposes than exceptions, which have a different purpose.