I often slect the whole notebook to evaluate. Sometimes some functions may return wrong parameters, which may happen, for example, I may have forgotten to specify values to some variables in the function, or due to some internal errors such as reading a file failed. When this happens, the subsquent evaluations could take extremely long time, which can't be exited using Alt+/, and I have to Quit the kernal or shut down the softward completely when it is freezing.

Hence, I'd like to stop all the subsquent evaluations once I found an error, like I got an $Failed flag after reading a file. The Abort[] can only skip one execution. I wonder if there is any command to stop all the subsquent evaluations, so that I can use the command to stop the subsquent evaluations when I detect an error flag?

I already seen this, but doesn't work for me on windows 10. The two prints * and ** are both printed in the notebook. Thanks.

$\begingroup$@MichaelE2, thanks for the comments, the approach by Kuba does work, though it's more complex than I have expected. I wonder if I have to include the definition of the assertfunction in any nb file that need to use it? Or can I embedd it in the functions (within user-defined packages) which needs to use the Assert[]? Alternatively, is there anyway to set it as defaults, so that it takes effect in any notebook, even if I restart the kernel? If so, how can I reset it, and see the list of options that I overwrite? Thanks$\endgroup$
– larryDec 13 '19 at 14:22

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.