Completely redo error handling, this time useful for extensions e.g. sdl2kit