exception is a runtime error or compile time code example
Example: compilation vs runtime error in c
A runtime error happens during the running of the program.
A compiler error happens when you try to compile the code.
If you are unable to compile your code, that is a compiler error.
If you compile and run your code, but then it fails during execution,
that is runtime.