You shouldn't report errors this way, it will trigger a RuntimeException, which is not caught by default in catch blocs. Throw a new SparkException instead.