Giter Club home page Giter Club logo

Comments (12)

andoma avatar andoma commented on May 24, 2024

This is definitely an improvement over the current solution which results in very confusing backtraces.

from duktape.

svaarala avatar svaarala commented on May 24, 2024

Looks definitely like something to fix, thanks for reporting it.

from duktape.

svaarala avatar svaarala commented on May 24, 2024

Technically it might be useful if the modSearch() function could provide the filename if the file actually gets loaded from a file system (not always the case but quite common).

Unfortunately this isn't easily fixable for 1.x because but we can look into changing the contract (@creationix had also some issues with the current one, specifically re: giving a fully resolved ID to modSearch) in 2.0.

from duktape.

svaarala avatar svaarala commented on May 24, 2024

Ah, I see. The duk_bi_global_object_require() already does the following which spot fixes the fileName for the module function itself, but that of course doesn't get "inherited" into functions defined within the module:

        /* Finish the wrapped module source. */
        duk_push_string(ctx, "})");
        duk_concat(ctx, 3);
        duk_eval(ctx);

        /* Force 'fileName' property of the module function so that if the
         * module creates a logger, the logger name defaults to the module
         * name.
         */
        duk_dup(ctx, 3);
        duk_put_prop_stridx(ctx, -2, DUK_STRIDX_FILE_NAME);

The proposed change fixes the issue and also removes the unnecessary forcing of the fileName, which is nice. I'll merge a fix soon.

from duktape.

svaarala avatar svaarala commented on May 24, 2024

The merge should fix the issue, and the following testcase was added to check for the preferred behavior at this point:

19491ef

from duktape.

svaarala avatar svaarala commented on May 24, 2024

@emil-e It'd be nice to hear if the merge (in master) fixed this issue for you. Quite probably so because the fix is practically the one you suggested originally, but still :)

from duktape.

emil-e avatar emil-e commented on May 24, 2024

I'll check it out :)

On Thursday, October 30, 2014, Sami Vaarala [email protected]
wrote:

@emil-e https://github.com/emil-e It'd be nice to hear if the merge (in
master) fixed this issue for you. Quite probably so because the fix is
practically the one you suggested originally, but still :)


Reply to this email directly or view it on GitHub
#58 (comment).

from duktape.

svaarala avatar svaarala commented on May 24, 2024

This is now also fixed in 1.0.1 release.

from duktape.

creationix avatar creationix commented on May 24, 2024

Awesome thanks. I wanted this patch, but I'm trying to be good and stick to released versions.

from duktape.

andoma avatar andoma commented on May 24, 2024

FWIW, I use 1.0.1 in https://github.com/andoma/showtime/ and there it now prints backtraces as it should.

from duktape.

svaarala avatar svaarala commented on May 24, 2024

@emil-e I'll close this now because it seems to be fixed - if not, please reopen.

from duktape.

emil-e avatar emil-e commented on May 24, 2024

Sorry for the delay, I haven't had time to test it since I've been
traveling but I can't imagine this not working. Andoma tested it and it
worked for him so I'm perfectly fine with closing. Thanks for the great
response!

On Friday, November 7, 2014, Sami Vaarala [email protected] wrote:

Closed #58 #58.


Reply to this email directly or view it on GitHub
#58 (comment).

from duktape.

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.