Giter Club home page Giter Club logo

Comments (10)

jianchun avatar jianchun commented on June 9, 2024

@aruneshchandra What's expected behavior?
@boingoing Do you happen to know about this?
Thanks!

from node-chakracore.

targos avatar targos commented on June 9, 2024

Async functions return a Promise when called. Do you get the same error with something like Promise.resolve() ?

from node-chakracore.

aruneshchandra avatar aruneshchandra commented on June 9, 2024

@targos - Yes

from node-chakracore.

boingoing avatar boingoing commented on June 9, 2024

I'm not familiar with REPL but looks like util.js is using the mirror debugger to inspect the promise instance. It may be probing for internal promise state. I don't have experience with it. Looks like the API is Debug.MakeMirror. Perhaps this is not supported yet.

@kunalspathak Do you have context on this?

from node-chakracore.

kunalspathak avatar kunalspathak commented on June 9, 2024

Yes, MakeMirror is a v8 specific debugging API that node uses to inspect the properties of an object and Chakracore doesn't have the implementation of it yet.

Sent from Outlook Mobilehttps://aka.ms/blhgte

On Mon, Mar 21, 2016 at 3:18 PM -0700, "Taylor Woll" <[email protected]mailto:[email protected]> wrote:

I'm not familiar with REPL but looks like util.js is using the mirror debugger to inspect the promise instance. It may be probing for internal promise state. I don't have experience with it. Looks like the API is Debug.MakeMirror. Perhaps this is not supported yet.

@kunalspathakhttps://github.com/kunalspathak Do you have context on this?

You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-199513901

from node-chakracore.

jianchun avatar jianchun commented on June 9, 2024

Thanks for these info! I prototyped a fake Debug.MakeMirror support to make this look nicer:

> async function foo() { }
undefined
> foo()
Promise { undefined }
> foo().then(function() { console.log("done") })
Promise { undefined }
> done

>

Currently I can only get "Promise { undefined }" disregarding real status (pending, resolved, ...). If we have APIs to inspect Promise internal states, we could improve this. Do we have any way to inspect? @boingoing

@aruneshchandra Would you like this to get in?

from node-chakracore.

boingoing avatar boingoing commented on June 9, 2024

@jianchun The engine tracks internal promise states but they aren't exposed via any Jsrt API. It shouldn't be too hard to add one. The fields you're interested in are JavascriptPromise::status and JavascriptPromise::result, I think.

from node-chakracore.

aruneshchandra avatar aruneshchandra commented on June 9, 2024

Having the real fix backed by the new JsRT api will be ideal, however I think we should take the current fix. Also it would be nice to show Promise { unknown } which seems more accurate in this case.

from node-chakracore.

jianchun avatar jianchun commented on June 9, 2024

@aruneshchandra Changed to

> async function foo() {}
undefined
> foo()
Promise { '<unknown>' }
> foo().then(()=>console.log('done'))
Promise { '<unknown>' }
> done

>

@agarwal-sandeep @liminzhu How will we inspect a Promise object from a debugger? Specifically need to access its "status" and "result" as @boingoing said.

from node-chakracore.

aruneshchandra avatar aruneshchandra commented on June 9, 2024

Sweet - thanx @jianchun !

from node-chakracore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.