BUG in error parsing of bucket.js

n1ql

#1

Hello there

in the current master of today and also all befor versions
bucket.js as a problem when parsing a n1ql timeout

it errors like this when n1ql times out

},
^

SyntaxError: Unexpected token }
    at Object.parse (native)
    at /app/node_modules/couchbase/lib/bucket.js:653:28

it turns out that the JSON parse of the errStr fails so i did add a try catch and got this as catched e

[SyntaxError: Unexpected token }]

the value of errStr:
},

],
"status": "timeout",
"metrics": {
    "elapsedTime": "1m15.555103945s"        {
        "dscms": {
            "duration": "05:00",
            "embed_code": "http://www.drtuber.com/embed/1194508",
            "id": "drtuber.com-1194508",
            "link": "http://drtuber.com/video/1194508/summer-anal-toys-and-fisting",
            "provider": "drtuber.com",
            "rating": "96%",
            "status": "new",
            "thumb_src": "http://p6.drtst.com/media/videos/tmb/1194508/240_180/19.jpg?1",
            "title": "Summer Anal Toys And Fisting",
            "type": "video",
            "video_id": "1194508"
        },
        "id": "video:drtuber.com-1194508"
    },
    "executionTime": "1m15.554937111s",
    "resultCount": 7870,
    "resultSize": 5789158,
    "sortCount": 167548
}

}

so its clear there is }, and ], at begin of the errStr

i dont followed where this val comes from and that but you can now maybe fix it. :slightly_smiling:


#2

Hey @frank81,

This has been corrected in a more recent version of our SDK. Sorry for your troubles!

Cheers, Brett