The build will die of natural causes if you have too many errors, or fundamental errors like a busted build path, but you cannot set the build to stop simply on a single compilation error like that, the reason is because the build process *itself* is what is used to determine where errors are.
Also, sometimes 1 error can cause 10 spurious/secondary errors and the real fix is just to fix that 1 error, stopping as soon as *1* error pops up could possibly put you in a position where you wouldn’t be able to fine the core/root error that needed to be fixed and could only see the secondary side-effect errors from it.
That’s why the build always tries to run to completion, to give you a complete picture of “what is wrong”.