[SPARK-2767] [SQL] Fix Bug of no output in cli if exception thrown internally