@@ -0,0 +1,2210 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.core.execute.threadlocal;%0A%0Aimport io.shardingsphere.core.exception.ShardingException;%0Aimport lombok.AccessLevel;%0Aimport lombok.NoArgsConstructor;%0Aimport lombok.extern.slf4j.Slf4j;%0A%0Aimport java.sql.SQLException;%0A%0A/**%0A * Executor runtime exception handler.%0A * %0A * @author zhangliang%0A */%0A@NoArgsConstructor(access = AccessLevel.PRIVATE)%0A@Slf4j%0Apublic final class ExecutorExceptionHandler %7B%0A    %0A    private static final ThreadLocal%3CBoolean%3E IS_EXCEPTION_THROWN = new ThreadLocal%3C%3E();%0A    %0A    /**%0A     * Set throw exception if error occur or not.%0A     *%0A     * @param isExceptionThrown throw exception if error occur or not%0A     */%0A    public static void setExceptionThrown(final boolean isExceptionThrown) %7B%0A        ExecutorExceptionHandler.IS_EXCEPTION_THROWN.set(isExceptionThrown);%0A    %7D%0A    %0A    /**%0A     * Get throw exception if error occur or not.%0A     * %0A     * @return throw exception if error occur or not%0A     */%0A    public static boolean isExceptionThrown() %7B%0A        return null == IS_EXCEPTION_THROWN.get() ? true : IS_EXCEPTION_THROWN.get();%0A    %7D%0A    %0A    /**%0A     * Handle exception. %0A     * %0A     * @param exception to be handled exception%0A     * @throws SQLException SQL exception%0A     */%0A    public static void handleException(final Exception exception) throws SQLException %7B%0A        if (isExceptionThrown()) %7B%0A            if (exception instanceof SQLException) %7B%0A                throw (SQLException) exception;%0A            %7D%0A            throw new ShardingException(exception);%0A        %7D%0A        log.error(%22exception occur: %22, exception);%0A    %7D%0A%7D%0A

add ExecutorExceptionHandler.java