jimhigson / oboe.js

A streaming approach to JSON. Oboe.js speeds up web applications by providing parsed objects before the response completes.
http://jimhigson.github.io/oboe.js-website/index.html
Other
4.79k stars 208 forks source link

TypeError: Cannot read property '0' of undefined #195

Open jalbersdorfer opened 5 years ago

jalbersdorfer commented 5 years ago

Problem

TypeError: Cannot read property '0' of undefined when parsing broken input like {"a": 1, "b

Location

"Oboe.js": "^2.1.4" - Oboe.js 2.1.4 and higher (master)

TypeError: Cannot read property '0' of undefined
    at C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:121:33
    at appendBuiltContent (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:1455:15)
    at nodeOpened (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:1436:7)
    at C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:1050:19
    at applyEach (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:496:20)
    at emit (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:1931:7)
    at emitError (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:630:9)
    at handleStreamEnd (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:665:7)
    at applyEach (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:496:20)
    at Object.emit (C:\tmp\oboe-bug-template\node_modules\oboe\dist\oboe-node.js:1931:7)

Steps to reproduce problem:

Desired or expected behavior:

I would expect the fail event handler to be called in that case, reporting something like Unexpected end

Observed behavior:

TypeError: Cannot read property '0' of undefined occurs.