tonylukasavage / triple

REPL for Titanium
MIT License
96 stars 21 forks source link

Very long return values cause error on server side #69

Closed tonylukasavage closed 10 years ago

tonylukasavage commented 10 years ago

On Android, if you try to inspect Titanium you'll get an error like this:

undefined:1
n        left: \u001b[90mundefined\u001b[39m,\n        softKeyboardOnFocus: \u
                                                                              ^
SyntaxError: Unexpected end of input
    at Object.parse (native)
    at Socket.<anonymous> (/Users/tlukasavage/development/triple/lib/server.js:37:20)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at TCP.onread (net.js:528:21)

I think this is because the socket reads probably have an upper limit on chunk size and triple is trying to JSON.parse() before the whole payload is received.

tonylukasavage commented 10 years ago

With #70 fixed, the error is now reduced to:

error with return value: Unexpected end of input