Skip to content

Commit

Permalink
Refactor FileIOException (#30784)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Apr 5, 2024
1 parent 06cfbce commit 2e2843d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
|-------------|-----------|---------------------------------------------------------------|
| 17000 | 44000 | Mode must be 'cluster'. |
| 17001 | HY000 | Work ID assigned failed, which can not exceed 1024. |
| 17002 | HY000 | File access failed, file is: %s |
| 17010 | HY000 | Cluster persist repository error, reason is: %s |
| 17020 | HY000 | The cluster status is %s, can not support SQL statement '%s'. |

Expand Down Expand Up @@ -259,3 +258,4 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| 30003 | 0A000 | Unsupported command: %s |
| 30004 | HY000 | Server exception: %s |
| 30010 | HY000 | Can not find plugin class '%s'. |
| 30020 | HY000 | File access failed, file is: %s |
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
|-------------|-----------|---------------------------------------------------------------|
| 17000 | 44000 | Mode must be 'cluster'. |
| 17001 | HY000 | Work ID assigned failed, which can not exceed 1024. |
| 17002 | HY000 | File access failed, file is: %s |
| 17010 | HY000 | Cluster persist repository error, reason is: %s |
| 17020 | HY000 | The cluster status is %s, can not support SQL statement '%s'. |

Expand Down Expand Up @@ -260,3 +259,4 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| 30003 | 0A000 | Unsupported command: %s |
| 30004 | HY000 | Server exception: %s |
| 30010 | HY000 | Can not find plugin class '%s'. |
| 30020 | HY000 | File access failed, file is: %s |
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@
* limitations under the License.
*/

package org.apache.shardingsphere.proxy.backend.exception;
package org.apache.shardingsphere.infra.exception.core.external.sql.type.generic;

import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ClusterSQLException;

import java.io.File;

/**
* File IO exception.
*/
public final class FileIOException extends ClusterSQLException {
public final class FileIOException extends GenericSQLException {

private static final long serialVersionUID = 1104839422339487793L;

public FileIOException(final File file) {
super(XOpenSQLState.GENERAL_ERROR, 2, "File access failed, file is: %s", file.getAbsolutePath());
super(XOpenSQLState.GENERAL_ERROR, 20, "File access failed, file is: %s", file.getAbsolutePath());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
import org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
import org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyDataSourceConfigurationSwapper;
import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.FileIOException;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.FileIOException;
import org.apache.shardingsphere.proxy.backend.util.YamlDatabaseConfigurationImportExecutor;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
import org.apache.shardingsphere.proxy.backend.distsql.export.ExportedClusterInfo;
import org.apache.shardingsphere.proxy.backend.distsql.export.ExportedMetaData;
import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.FileIOException;
import org.apache.shardingsphere.proxy.backend.util.YamlDatabaseConfigurationImportExecutor;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.FileIOException;

import java.io.File;
import java.io.IOException;
Expand Down

0 comments on commit 2e2843d

Please sign in to comment.