check: use an exception instead of calling sys.exit