Add `@nogc` attribute to `core.exception` functions.

The main change is `onOutOfMemoryError` & `onInvalidMemoryOperationError` are now `@nogc`.