Prevent use of std::exit and define exception handler

Explicit error (unexpected or normal) should be thrown using exceptions. The use of std::exit must be forbidden.