-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Improve fastboot debugger/repl experience #15321
Conversation
packages/container/lib/container.js
Outdated
@@ -190,6 +190,13 @@ function wrapManagerInDeprecationProxy(manager) { | |||
if (HAS_NATIVE_PROXY) { | |||
let validator = { | |||
get(obj, prop) { | |||
// make work with node's formatValue | |||
if (!(prop in obj)) { return ; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will obviously now fail if any of the following are actually defined on obj
Symbol(util.inspect.custom)
Symbol(Symbol.toStringTag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option, is to never trap:
- any symbol
- toString
@@ -190,7 +190,10 @@ function wrapManagerInDeprecationProxy(manager) { | |||
if (HAS_NATIVE_PROXY) { | |||
let validator = { | |||
get(obj, prop) { | |||
if (prop !== 'class' && prop !== 'create') { | |||
if (typeof prop === 'symbol') { return obj[prop]; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think never trapping symbols is perfectly good.
@@ -190,7 +190,10 @@ function wrapManagerInDeprecationProxy(manager) { | |||
if (HAS_NATIVE_PROXY) { | |||
let validator = { | |||
get(obj, prop) { | |||
if (prop !== 'class' && prop !== 'create') { | |||
if (typeof prop === 'symbol') { return obj[prop]; } | |||
if (prop === 'inspect') { return undefined; /* for nodes formatter */ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not happy about this one though...
I am not convinced we need to continue trapping |
That would greatly simplify this for-sure. As of what version do you feel comfortable dropping the |
We should land your current PR (basically blackholing all symbols and |
56c8fb1
to
241d659
Compare
FactoryManager debug proxy and nodes formatValue don't play nicely. Basically, we throw when they legitimately try to inspect these objects. I'm not terribly happy with this solution, we can likely improve it. Maybe we should chat with the node folks to get there pulse on this... Original issue (this fixes) was from @locks -> stefanpenner/ember-console#8 Log: <details> <summary>TypeError: Cannot convert a Symbol value to a string</summary> ``` > app.instance TypeError: Cannot convert a Symbol value to a string at Object.get (/Users/ricardomendes/src/--ember/ember-cli-developer-tools/dist/assets/vendor/ember/ember.debug.js:9750:1) at formatValue (util.js:362:37) at formatProperty (util.js:822:15) at util.js:681:12 at Array.map (native) at formatObject (util.js:680:15) at formatValue (util.js:620:16) at formatProperty (util.js:822:15) at util.js:681:12 at Array.map (native) at formatObject (util.js:680:15) at formatValue (util.js:620:16) at formatProperty (util.js:822:15) at util.js:681:12 at Array.map (native) at formatObject (util.js:680:15) at formatValue (util.js:620:16) at Object.inspect (util.js:203:10) at REPLServer.self.writer (repl.js:459:19) at finish (repl.js:584:38) at REPLServer.defaultEval (repl.js:377:5) at bound (domain.js:280:14) at REPLServer.runBound (domain.js:293:12) at REPLServer.eval (/Users/ricardomendes/src/--ember/ember-cli-developer-tools/node_modules/await-outside/index.js:136:29) at REPLServer.onLine (repl.js:536:10) at emitOne (events.js:96:13) at REPLServer.emit (events.js:191:7) at REPLServer.Interface._onLine (readline.js:241:10) at REPLServer.Interface._line (readline.js:590:8) at REPLServer.Interface._ttyWrite (readline.js:869:14) at REPLServer.self._ttyWrite (repl.js:609:7) at ReadStream.onkeypress (readline.js:120:10) at emitTwo (events.js:106:13) at ReadStream.emit (events.js:194:7) at emitKeys (internal/readline.js:402:14) at emitKeys.next (<anonymous>) at ReadStream.onData (readline.js:980:36) at emitOne (events.js:96:13) at ReadStream.emit (events.js:191:7) at readableAddChunk (_stream_readable.js:178:18) at ReadStream.Readable.push (_stream_readable.js:136:10) at TTY.onread (net.js:561:20) ``` </details>
241d659
to
74edc63
Compare
@rwjblue done |
FactoryManager debug proxy and nodes formatValue don't play nicely. Basically, we throw when they legitimately try to inspect these objects.
I'm not terribly happy with this solution, we can likely improve it. Maybe we should chat with the node folks to get there pulse on this...
Original issue (this fixes) was from @locks -> stefanpenner/ember-console#8
Log:
TypeError: Cannot convert a Symbol value to a string