diff --git a/CHANGELOG.md b/CHANGELOG.md index 90655c76..a542b81e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,10 @@ This source code is licensed under Apache 2.0 License. # NEXT (1.2.2-SNAPSHOT) +## Bugfix + +- fix: complete the error code of ResultSet into QueryException. + ## Dependencies upgrade - [ ] nebula-java: 3.6.0 -> 3.6.1 diff --git a/README-CN.md b/README-CN.md index d4e7deb6..44a042b4 100644 --- a/README-CN.md +++ b/README-CN.md @@ -46,8 +46,8 @@ This source code is licensed under Apache 2.0 License. NgBatis | nebula-java | JDK | Springboot | Beetl ---|-------------|---|------------|--- - 1.2.1-jdk17-SNAPSHOT | 3.6.0 | 17 | 3.0.7 | 3.15.10.RELEASE - 1.2.1-SNAPSHOT | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE + 1.2.2-jdk17-SNAPSHOT | 3.6.0 | 17 | 3.0.7 | 3.15.10.RELEASE + 1.2.2-SNAPSHOT | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE > 在同版本号快照版中,依赖的第三方可能会随时升级 diff --git a/README.md b/README.md index ce70ee70..c983dab7 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ See [EXECUTION-PROCESS.md](./EXECUTION-PROCESS.md) NgBatis | nebula-java | JDK | Springboot | Beetl ---|-------------|---|------------|--- - 1.2.1-jdk17-SNAPSHOT | 3.6.0 | 17 | 3.0.7 | 3.15.10.RELEASE - 1.2.1-SNAPSHOT | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE + 1.2.2-jdk17-SNAPSHOT | 3.6.0 | 17 | 3.0.7 | 3.15.10.RELEASE + 1.2.2-SNAPSHOT | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE > The third-party dependencies may differ within the same snapshot version. diff --git a/ngbatis-demo/pom.xml b/ngbatis-demo/pom.xml index c6ebc63c..b22bef5c 100644 --- a/ngbatis-demo/pom.xml +++ b/ngbatis-demo/pom.xml @@ -50,7 +50,7 @@ org.nebula-contrib ngbatis - 1.2.1-SNAPSHOT + 1.2.2-SNAPSHOT diff --git a/pom.xml b/pom.xml index cdd1d336..036fb5fb 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ ngbatis org.nebula-contrib ngbatis - 1.2.1 + 1.2.2-SNAPSHOT NgBatis is a database ORM framework base NebulaGraph + spring-boot, diff --git a/src/main/java/org/nebula/contrib/ngbatis/exception/QueryException.java b/src/main/java/org/nebula/contrib/ngbatis/exception/QueryException.java index 3a63a4af..1ddb3460 100644 --- a/src/main/java/org/nebula/contrib/ngbatis/exception/QueryException.java +++ b/src/main/java/org/nebula/contrib/ngbatis/exception/QueryException.java @@ -12,6 +12,13 @@ */ public class QueryException extends RuntimeException { + /** + * Set by {@link com.vesoft.nebula.client.graph.data.ResultSet#getErrorCode()} + *
+ * Will be null when the exception is not caused by nGQL + */ + private Integer code; + public QueryException() { } @@ -19,6 +26,11 @@ public QueryException(String o) { super(o); } + public QueryException(String o, Integer code) { + super(o); + this.code = code; + } + public QueryException(String o, Throwable e) { super(o, e); } diff --git a/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java b/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java index 31e55452..9175c1bc 100644 --- a/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java +++ b/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java @@ -236,7 +236,10 @@ public static ResultSet executeWithParameter(ClassModel cm, MethodModel mm, Stri if (result.isSucceeded()) { return result; } else { - throw new QueryException(" 数据查询失败" + result.getErrorMessage()); + throw new QueryException( + " 数据查询失败" + result.getErrorMessage(), + result.getErrorCode() + ); } } catch (Exception e) { throw new QueryException("数据查询失败:" + e.getMessage(), e); @@ -285,7 +288,10 @@ public static ResultSet executeBySessionPool(ClassModel cm, MethodModel mm, Stri if (result.isSucceeded()) { return result; } else { - throw new QueryException(" ResultSet error: " + result.getErrorMessage()); + throw new QueryException( + " ResultSet error: " + result.getErrorMessage(), + result.getErrorCode() + ); } } catch (Exception e) { throw new QueryException("execute failed: " + e.getMessage(), e);