Unify compile/release diagnostics

Rather than log an error and abort, raise an exception so that the
general exception handling in a calling stack frame will be used.

This reduces the amount of code and also provides a suitable
exception stack trace when debug logging is enabled.

[#53862463]
Merge 53862463-compile-release-robustness to master

[Completes #53862463]