-
Notifications
You must be signed in to change notification settings - Fork 155
Adding error check of unsupported types #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhenlineo review completed. Made two comments. It would also be nice to add ITs which use nodes, relationships and paths as query parameters.
@@ -91,6 +94,10 @@ public static Value value( Object value ) | |||
{ | |||
if ( value == null ) { return NullValue.NULL; } | |||
|
|||
if ( value instanceof NodeValue || value instanceof RelationshipValue || value instanceof PathValue ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be better to prohibit node, relationship and path in PackStreamMessageFormatV1
. It is clear that struct packing code is the single point that writes structs to the channel. While Values#value()
is just one of many factory methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to do it outside/earlier is because when we got an error there, we will kill the connection, which seems too aggressive. So if we could found the error in advance, then we will simply pop an error to the surface.
@@ -70,12 +70,12 @@ public void shouldTypeAsNode() | |||
assertThat( value.typeConstructor(), equalTo( TypeConstructor.NODE ) ); | |||
} | |||
|
|||
private NodeValue emptyNodeValue() | |||
public static NodeValue emptyNodeValue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please extract NodeValueTest#emptyNodeValue()
, PathValueTest#pathValue()
and RelationshipValueTest#emptyRelationshipValue()
into a test utility class. Alternatively ValuesTest
could just create it's own node, relationship and path values.
5150775
to
6984fa0
Compare
The input parameters could be of type: * Map<String, Object> * Record * MapValue generated via Values#parameters * MapValue If the input parameters are provided by a Map<String, Object> or Record, or Values#parameters, then any unsupported types will be captured via Values#value. If the input parameters are provided by a MapValue directly, then any unsupported types will be captured at PackStream#pack.
6984fa0
to
af8c5b7
Compare
…est util Some tests needs this server side packer to serialize such types.
3e9ee16
to
76afa48
Compare
Fixes neo4j/neo4j#10239