provegard / ncdbg

A debugger for Nashorn that uses Chrome DevTools as frontend
BSD 3-Clause "New" or "Revised" License
31 stars 5 forks source link

Exception when hovering over property of undefined #15

Closed provegard closed 7 years ago

provegard commented 7 years ago

If you hover over a property of an undefined variable, ncdbg logs an error:

Code evaluation failed.
com.programmaticallyspeaking.ncd.nashorn.InvocationFailedException: Invocation failed: jdk.nashorn.internal.runtime.ECMAException: TypeError: Cannot read property "toString" from undefined
    at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
    at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)
    at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)
    at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)
    at jdk.nashorn.internal.runtime.Undefined.get(Undefined.java:157)
    at jdk.nashorn.internal.scripts.Script$15$\^eval\_.:program(<eval>:1)
    at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:623)
    at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
    at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
    at jdk.nashorn.internal.runtime.Context.eval(Context.java:736)
    at jdk.nashorn.internal.runtime.Context.eval(Context.java:671)

The message:

10:20:14.047 [default-akka.actor.default-dispatcher-3] DEBUG c.p.ncd.chrome.net.DevToolsHandler - Incoming message from Developer Tools: IncomingMessage(46,Debugger.evaluateOnCallFrame,Map(silent -> true, generatePreview -> false, includeCommandLineAPI -> false, objectGroup -> popover, expression -> e.toString, returnByValue -> false, callFrameId -> ndsf8))

This ought to be handled in a nicer way, especially since silent is true.