Skip to content
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

Uncaught Error: toString failed #22

Closed
n-riesco opened this issue Nov 2, 2016 · 2 comments
Closed

Uncaught Error: toString failed #22

n-riesco opened this issue Nov 2, 2016 · 2 comments

Comments

@n-riesco
Copy link
Owner

n-riesco commented Nov 2, 2016

See nteract/hydrogen#491 and nodejs/node#4394


I'm getting this error when trying to print a (rather large) variable. After the error, trying to run other lines gives a checkmark but no actual output.

Atom Version: 1.11.2
Electron Version: 0.37.8
System: Mac OS X 10.10.5
Thrown From: Hydrogen package, v0.15.0

Stack Trace

Uncaught Error: toString failed

At events.js:154

Error: toString failed
    at Buffer.toString (buffer.js:490:11)
    at toJSON (/Users/dnowacki/.atom/packages/Hydrogen/node_modules/jmp/index.js:225:33)
    at Function.Message._decode (/Users/dnowacki/.atom/packages/Hydrogen/node_modules/jmp/index.js:217:18)
    at Socket.<anonymous> (/Users/dnowacki/.atom/packages/Hydrogen/node_modules/jmp/index.js:330:35)
    at emitMany (events.js:121:13)
    at Socket.emit (events.js:195:7)
    at Socket._flushRead (/Users/dnowacki/.atom/packages/Hydrogen/node_modules/zmq/lib/index.js:638:15)
    at Socket._flushReads (/Users/dnowacki/.atom/packages/Hydrogen/node_modules/zmq/lib/index.js:676:23)
    at _zmq.onReadReady (/Users/dnowacki/.atom/packages/Hydrogen/node_modules/zmq/lib/index.js:297:10)
@n-riesco
Copy link
Owner Author

n-riesco commented Nov 2, 2016

Message::_decode can throw this error.

Message::on wraps message listeners with a callback that invokes calls Message::_decode.

Message::once wraps message listeners with a callback that invokes calls Message::_decode.

Message::_encode creates buffers.

Message::send calls Message::_encode.

@n-riesco
Copy link
Owner Author

n-riesco commented Nov 2, 2016

At the moment, I'm inclined to work around this issue by wrapping the body of Message::_decode in a try-catch block and return null if an exception of this kind is thrown.

n-riesco added a commit that referenced this issue Nov 16, 2017
* Workaround for Buffer.toString failure caused by exceeding the maximum
  supported length in V8.

* See issue nodejs/node#4266
  and PR nodejs/node#4394

Fixes #22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant