Move exception to the main class.

The exception should not be accessed by someone else than the main class
of the core.