Skip to content

Commit 13f7bda

Browse files
committed
Update statuses
1 parent 39b3806 commit 13f7bda

File tree

53 files changed

+1989
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1989
-301
lines changed

driver/src/main/java/org/neo4j/driver/Values.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import java.util.stream.Stream;
4141
import org.neo4j.driver.exceptions.ClientException;
4242
import org.neo4j.driver.internal.AsValue;
43+
import org.neo4j.driver.internal.GqlStatusError;
4344
import org.neo4j.driver.internal.InternalIsoDuration;
4445
import org.neo4j.driver.internal.InternalPoint2D;
4546
import org.neo4j.driver.internal.InternalPoint3D;
@@ -214,9 +215,12 @@ public static Value value(Object value) {
214215
}
215216

216217
throw new ClientException(
217-
"22000",
218-
"data exception",
219-
"Unable to convert " + value.getClass().getName() + " to Neo4j Value.");
218+
GqlStatusError.UNKNOWN.getStatus(),
219+
GqlStatusError.UNKNOWN.getExplanation(),
220+
"N/A",
221+
"Unable to convert " + value.getClass().getName() + " to Neo4j Value.",
222+
GqlStatusError.DIAGNOSTIC_RECORD,
223+
null);
220224
}
221225

222226
/**
@@ -592,12 +596,15 @@ public static Value point(int srid, double x, double y, double z) {
592596
public static Value parameters(Object... keysAndValues) {
593597
if (keysAndValues.length % 2 != 0) {
594598
throw new ClientException(
595-
"22000",
596-
"data exception",
599+
GqlStatusError.UNKNOWN.getStatus(),
600+
GqlStatusError.UNKNOWN.getExplanation(),
601+
"N/A",
597602
"Parameters function requires an even number " + "of arguments, "
598603
+ "alternating key and value. Arguments were: "
599604
+ Arrays.toString(keysAndValues)
600-
+ ".");
605+
+ ".",
606+
GqlStatusError.DIAGNOSTIC_RECORD,
607+
null);
601608
}
602609
HashMap<String, Value> map = newHashMapWithSize(keysAndValues.length / 2);
603610
for (var i = 0; i < keysAndValues.length; i += 2) {

driver/src/main/java/org/neo4j/driver/exceptions/AuthTokenManagerExecutionException.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.Serial;
2020
import org.neo4j.driver.AuthTokenManager;
21+
import org.neo4j.driver.internal.GqlStatusError;
2122

2223
/**
2324
* The {@link org.neo4j.driver.AuthTokenManager} execution has lead to an unexpected result.
@@ -42,6 +43,12 @@ public class AuthTokenManagerExecutionException extends ClientException {
4243
* @param cause the cause
4344
*/
4445
public AuthTokenManagerExecutionException(String message, Throwable cause) {
45-
super("22000", "data exception", message, cause);
46+
super(
47+
GqlStatusError.UNKNOWN.getStatus(),
48+
GqlStatusError.UNKNOWN.getExplanation(),
49+
"N/A",
50+
message,
51+
GqlStatusError.DIAGNOSTIC_RECORD,
52+
cause);
4653
}
4754
}

driver/src/main/java/org/neo4j/driver/exceptions/AuthenticationException.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serial;
2020
import java.util.Map;
2121
import org.neo4j.driver.Value;
22+
import org.neo4j.driver.internal.GqlStatusError;
23+
import org.neo4j.driver.util.Preview;
2224

2325
/**
2426
* Failed to authenticate the driver to the server due to bad credentials provided.
@@ -36,19 +38,28 @@ public class AuthenticationException extends SecurityException {
3638
* @param code the code
3739
* @param message the message
3840
*/
41+
// for testing only
3942
public AuthenticationException(String code, String message) {
40-
super(code, message);
43+
this(
44+
GqlStatusError.UNKNOWN.getStatus(),
45+
GqlStatusError.UNKNOWN.getExplanation(),
46+
code,
47+
message,
48+
GqlStatusError.DIAGNOSTIC_RECORD,
49+
null);
4150
}
4251

4352
/**
44-
* TODO
45-
* @param gqlStatus TODO
46-
* @param statusExplanation TODO
47-
* @param code TODO
48-
* @param message TODO
49-
* @param diagnosticRecord TODO
50-
* @param cause TODO
53+
* Creates a new instance.
54+
* @param gqlStatus the GQLSTATUS as defined by the GQL standard
55+
* @param statusExplanation the status explanation
56+
* @param code the code
57+
* @param message the message
58+
* @param diagnosticRecord the diagnostic record
59+
* @param cause the cause
60+
* @since 5.23.0
5161
*/
62+
@Preview(name = "GQL-error")
5263
public AuthenticationException(
5364
String gqlStatus,
5465
String statusExplanation,

driver/src/main/java/org/neo4j/driver/exceptions/AuthorizationExpiredException.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serial;
2020
import java.util.Map;
2121
import org.neo4j.driver.Value;
22+
import org.neo4j.driver.internal.GqlStatusError;
23+
import org.neo4j.driver.util.Preview;
2224

2325
/**
2426
* The authorization info maintained on the server has expired. The client should reconnect.
@@ -40,19 +42,28 @@ public class AuthorizationExpiredException extends SecurityException implements
4042
* @param code the code
4143
* @param message the message
4244
*/
45+
// for testing only
4346
public AuthorizationExpiredException(String code, String message) {
44-
super(code, message);
47+
this(
48+
GqlStatusError.UNKNOWN.getStatus(),
49+
GqlStatusError.UNKNOWN.getExplanation(),
50+
code,
51+
message,
52+
GqlStatusError.DIAGNOSTIC_RECORD,
53+
null);
4554
}
4655

4756
/**
48-
* TODO
49-
* @param gqlStatus TODO
50-
* @param statusExplanation TODO
51-
* @param code TODO
52-
* @param message TODO
53-
* @param diagnosticRecord TODO
54-
* @param cause TODO
57+
* Creates a new instance.
58+
* @param gqlStatus the GQLSTATUS as defined by the GQL standard
59+
* @param statusExplanation the status explanation
60+
* @param code the code
61+
* @param message the message
62+
* @param diagnosticRecord the diagnostic record
63+
* @param cause the cause
64+
* @since 5.23.0
5565
*/
66+
@Preview(name = "GQL-error")
5667
public AuthorizationExpiredException(
5768
String gqlStatus,
5869
String statusExplanation,

driver/src/main/java/org/neo4j/driver/exceptions/ClientException.java

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serial;
2020
import java.util.Map;
2121
import org.neo4j.driver.Value;
22+
import org.neo4j.driver.internal.GqlStatusError;
23+
import org.neo4j.driver.util.Preview;
2224

2325
/**
2426
* A <em>ClientException</em> indicates that the client has carried out an operation incorrectly.
@@ -35,7 +37,13 @@ public class ClientException extends Neo4jException {
3537
*/
3638
// for testing only
3739
public ClientException(String message) {
38-
super(message);
40+
this(
41+
GqlStatusError.UNKNOWN.getStatus(),
42+
GqlStatusError.UNKNOWN.getExplanation(),
43+
"N/A",
44+
message,
45+
GqlStatusError.DIAGNOSTIC_RECORD,
46+
null);
3947
}
4048

4149
/**
@@ -45,50 +53,42 @@ public ClientException(String message) {
4553
*/
4654
// for testing only
4755
public ClientException(String message, Throwable cause) {
48-
super(message, cause);
56+
this(
57+
GqlStatusError.UNKNOWN.getStatus(),
58+
GqlStatusError.UNKNOWN.getExplanation(),
59+
"N/A",
60+
message,
61+
GqlStatusError.DIAGNOSTIC_RECORD,
62+
cause);
4963
}
5064

5165
/**
5266
* Creates a new instance.
5367
* @param code the code
5468
* @param message the message
5569
*/
70+
// for testing only
5671
public ClientException(String code, String message) {
57-
super(code, message);
72+
this(
73+
GqlStatusError.UNKNOWN.getStatus(),
74+
GqlStatusError.UNKNOWN.getExplanation(),
75+
code,
76+
message,
77+
GqlStatusError.DIAGNOSTIC_RECORD,
78+
null);
5879
}
5980

6081
/**
61-
* TODO
62-
* @param gqlStatus TODO
63-
* @param statusExplanation TODO
64-
* @param message TODO
65-
* @since 5.23.0
66-
*/
67-
public ClientException(String gqlStatus, String statusExplanation, String message) {
68-
this(gqlStatus, statusExplanation, message, null);
69-
}
70-
71-
/**
72-
* TODO
73-
* @param gqlStatus TODO
74-
* @param statusExplanation TODO
75-
* @param message TODO
76-
* @param cause TODO
82+
* Creates a new instance.
83+
* @param gqlStatus the GQLSTATUS as defined by the GQL standard
84+
* @param statusExplanation the status explanation
85+
* @param code the code
86+
* @param message the message
87+
* @param diagnosticRecord the diagnostic record
88+
* @param cause the cause
7789
* @since 5.23.0
7890
*/
79-
public ClientException(String gqlStatus, String statusExplanation, String message, Throwable cause) {
80-
super(gqlStatus, statusExplanation, message, cause);
81-
}
82-
83-
/**
84-
* TODO
85-
* @param gqlStatus TODO
86-
* @param statusExplanation TODO
87-
* @param code TODO
88-
* @param message TODO
89-
* @param diagnosticRecord TODO
90-
* @param cause TODO
91-
*/
91+
@Preview(name = "GQL-error")
9292
public ClientException(
9393
String gqlStatus,
9494
String statusExplanation,

driver/src/main/java/org/neo4j/driver/exceptions/DatabaseException.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serial;
2020
import java.util.Map;
2121
import org.neo4j.driver.Value;
22+
import org.neo4j.driver.internal.GqlStatusError;
23+
import org.neo4j.driver.util.Preview;
2224

2325
/**
2426
* A <em>DatabaseException</em> indicates that there is a problem within the underlying database.
@@ -34,19 +36,28 @@ public class DatabaseException extends Neo4jException {
3436
* @param code the code
3537
* @param message the message
3638
*/
39+
// for testing only
3740
public DatabaseException(String code, String message) {
38-
super(code, message);
41+
this(
42+
GqlStatusError.UNKNOWN.getStatus(),
43+
GqlStatusError.UNKNOWN.getExplanation(),
44+
code,
45+
message,
46+
GqlStatusError.DIAGNOSTIC_RECORD,
47+
null);
3948
}
4049

4150
/**
42-
* TODO
43-
* @param gqlStatus TODO
44-
* @param statusExplanation TODO
45-
* @param code TODO
46-
* @param message TODO
47-
* @param diagnosticRecord TODO
48-
* @param cause TODO
51+
* Creates a new instance.
52+
* @param gqlStatus the GQLSTATUS as defined by the GQL standard
53+
* @param statusExplanation the status explanation
54+
* @param code the code
55+
* @param message the message
56+
* @param diagnosticRecord the diagnostic record
57+
* @param cause the cause
58+
* @since 5.23.0
4959
*/
60+
@Preview(name = "GQL-error")
5061
public DatabaseException(
5162
String gqlStatus,
5263
String statusExplanation,

driver/src/main/java/org/neo4j/driver/exceptions/DiscoveryException.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.neo4j.driver.exceptions;
1818

1919
import java.io.Serial;
20+
import org.neo4j.driver.internal.GqlStatusError;
2021

2122
/**
2223
* An error has happened while getting routing table with a remote server.
@@ -36,6 +37,12 @@ public class DiscoveryException extends Neo4jException {
3637
* @param cause the cause
3738
*/
3839
public DiscoveryException(String message, Throwable cause) {
39-
super("08000", "connection exception", message, cause);
40+
super(
41+
GqlStatusError.UNKNOWN.getStatus(),
42+
GqlStatusError.UNKNOWN.getExplanation(),
43+
"N/A",
44+
message,
45+
GqlStatusError.DIAGNOSTIC_RECORD,
46+
cause);
4047
}
4148
}

driver/src/main/java/org/neo4j/driver/exceptions/FatalDiscoveryException.java

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serial;
2020
import java.util.Map;
2121
import org.neo4j.driver.Value;
22+
import org.neo4j.driver.internal.GqlStatusError;
23+
import org.neo4j.driver.util.Preview;
2224

2325
/**
2426
* This error indicate a fatal problem to obtain routing tables such as the routing table for a specified database does not exist.
@@ -33,28 +35,44 @@ public class FatalDiscoveryException extends ClientException {
3335
* Creates a new instance.
3436
* @param message the message
3537
*/
38+
// for testing only
3639
public FatalDiscoveryException(String message) {
37-
super("08000", "connection exception", message);
40+
this(
41+
GqlStatusError.UNKNOWN.getStatus(),
42+
GqlStatusError.UNKNOWN.getExplanation(),
43+
"N/A",
44+
message,
45+
GqlStatusError.DIAGNOSTIC_RECORD,
46+
null);
3847
}
3948

4049
/**
4150
* Creates a new instance.
4251
* @param code the code
4352
* @param message the message
4453
*/
54+
// for testing only
4555
public FatalDiscoveryException(String code, String message) {
46-
super(code, message);
56+
this(
57+
GqlStatusError.UNKNOWN.getStatus(),
58+
GqlStatusError.UNKNOWN.getExplanation(),
59+
code,
60+
message,
61+
GqlStatusError.DIAGNOSTIC_RECORD,
62+
null);
4763
}
4864

4965
/**
50-
* TODO
51-
* @param gqlStatus TODO
52-
* @param statusExplanation TODO
53-
* @param code TODO
54-
* @param message TODO
55-
* @param diagnosticRecord TODO
56-
* @param cause TODO
66+
* Creates a new instance.
67+
* @param gqlStatus the GQLSTATUS as defined by the GQL standard
68+
* @param statusExplanation the status explanation
69+
* @param code the code
70+
* @param message the message
71+
* @param diagnosticRecord the diagnostic record
72+
* @param cause the cause
73+
* @since 5.23.0
5774
*/
75+
@Preview(name = "GQL-error")
5876
public FatalDiscoveryException(
5977
String gqlStatus,
6078
String statusExplanation,

0 commit comments

Comments
 (0)