tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jorge Bay (Jira)" <j...@apache.org>
Subject [jira] [Commented] (TINKERPOP-2285) Error object is unreachable
Date Tue, 20 Aug 2019 08:50:00 GMT

    [ https://issues.apache.org/jira/browse/TINKERPOP-2285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16911117#comment-16911117
] 

Jorge Bay commented on TINKERPOP-2285:
--------------------------------------

hm... You mean that the error message is the string:
{code}
'{"requestId":"e44b2c9a-9542-461b-9d1b-bc3db3f869f4","code":"ConstraintViolationException","detailedMessage":"Edge
with id already exists: TEST|77886.105.1:NO_SIZE:0->WVN"}'
{code}

That is unexpected, as you pointed out the error message is the [stringified response status
message|https://github.com/apache/tinkerpop/blob/3.4.3/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js#L265],
which is a string: https://github.com/apache/tinkerpop/blob/master/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/ResponseStatus.java#L47

Are you using gremlin server or another database?

> Error object is unreachable
> ---------------------------
>
>                 Key: TINKERPOP-2285
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2285
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: javascript
>    Affects Versions: 3.3.8
>            Reporter: Teonna Zaragoza
>            Priority: Major
>
> In our currently application(React, node.js, Express), we are creating an edge between
two existing nodes.
> {code:java}
> async function somethingThatQueriesGremlin() {
>   try {
>     const result = await theActualQuery(); 
>     // ...
>   } catch (error) {
>     console.log(error); // I expect error to be useful and not a stringified instance
of Error wrapped in an Error.
>   }
> } {code}
> If the edge already exists, the error that is logged on the server is
> {code:javascript}
> Error: Server error: {"requestId":"e44b2c9a-9542-461b-9d1b-bc3db3f869f4","code":"ConstraintViolationException","detailedMessage":"Edge
with id already exists: TEST|77886.105.1:NO_SIZE:0->WVN"} (499)
>     at Connection._handleMessage (.../node_modules/gremlin/lib/driver/connection.js:265:9)
>     at WebSocket._ws.on (.../node_modules/gremlin/lib/driver/connection.js:128:43)
>     at emitOne (events.js:116:13)
>     at WebSocket.emit (events.js:211:7)
>     at Receiver._receiver.onmessage (.../node_modules/ws/lib/WebSocket.js:141:47)
>     at Receiver.dataMessage (.../node_modules/ws/lib/Receiver.js:380:14)
>     at Receiver.getData (.../node_modules/ws/lib/Receiver.js:330:12)
>     at Receiver.startLoop (.../node_modules/ws/lib/Receiver.js:165:16)
>     at Receiver.add (.../node_modules/ws/lib/Receiver.js:139:10)
>     at TLSSocket._ultron.on (.../node_modules/ws/lib/WebSocket.js:138:22)
>     at emitOne (events.js:116:13)
>     at TLSSocket.emit (events.js:211:7)
>     at addChunk (_stream_readable.js:263:12)
>     at readableAddChunk (_stream_readable.js:250:11)
>     at TLSSocket.Readable.push (_stream_readable.js:208:10)
>     at TLSWrap.onread (net.js:607:20)
> object
> {code}
> The problem is that the actual error object with reachable keys is a string within another
error object. The stringified object is reachable via err.message. 
> The error comes from the driver in connection.js line 265
> {code:java}
> newError(util.format('Server error: %s (%d)',response.status.message,response.status.code)));
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Mime
View raw message