• Redkey@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    2 hours ago

    My first suspect is an incorrectly-terminated statement which looks like it should end on line 41. The compiler/interpreter probably read the newline and ticked over before uncovering the error, and didn’t recover properly due to some edge case.

  • Aedis@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    8 hours ago

    This is why we have debug and release builds.

    So that when actual clients tell us there’s an error on line 42 we close the bug instantly as a no repro.

    /s

  • marlowe221@lemmy.world
    link
    fedilink
    English
    arrow-up
    35
    ·
    11 hours ago

    This happens all the time with TypeScript. The transpiled JS that actually runs will naturally have different line numbers than the TS you wrote!

    To be fair, the reported line number is usually close enough that I can find the issue without much trouble.

    It’s not my favorite back end language, but it’s what everyone on my team knows…

    • folekaule@lemmy.world
      link
      fedilink
      arrow-up
      24
      ·
      10 hours ago

      This is what source maps are for. With the right tools you can debug the original source instead of the minified version.

      • lobut@lemmy.ca
        link
        fedilink
        arrow-up
        7
        ·
        8 hours ago

        Remember to add --enable-source-maps and as long as your tools are configured properly it should point to the right line!

        • marlowe221@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 hour ago

          Thanks for the tip! I’ll double check that when I get back to work next week.

          I’ve written a lot of NodeJS apps in vanilla JS, and plenty of .NET backend stuff too. The transition to serious TS has been relatively recent. I like it alright, but dislike the added complexity that comes with all the various config files - vanilla JS has enough of that already!

      • marlowe221@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        8 hours ago

        Well sure. But the error messages don’t point to those, which was what had me chuckling about this meme.

          • marlowe221@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            4 hours ago

            Oh, they are included in the build. But I still get error messages that don’t actually point to the line in the TS source file sometimes.

            Maybe I have something configured wrong - TS projects always include a more config files of different kinds than I see in other languages I work in - but it happens.

      • python@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        8 hours ago

        It’s surprisingly good as a backend language, if you don’t really need OOP all that much. The perfect case is probably using it in microservices that only really need to do a bit of data manipulation and some database interfacing.

        • marlowe221@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 hour ago

          I’ve had pretty good experiences with it even situations with moderate data manipulation. There are some tricks you can use to engage different phases of the event loop to keep the data processing from blocking too much.

          It’s still not as good as Java/C#/Go, of course, but it can help get some more performance out of Node.

  • Hellfire103@lemmy.ca
    link
    fedilink
    English
    arrow-up
    34
    ·
    edit-2
    12 hours ago

    That happens all the time with Python. It often shows me errors in the imported modules, which are easily confused with my own code if I’m tired and don’t read the message properly.

    • ZoteTheMighty@lemmy.zip
      link
      fedilink
      arrow-up
      3
      ·
      2 hours ago

      It can also happen in Python if you edit the file after runtime. It parses the code on import, but re-reads the file as text during the error message, so if you added or deleted lines, the error report can report a dubious line.

  • neukenindekeuken@sh.itjust.works
    link
    fedilink
    arrow-up
    5
    ·
    9 hours ago

    Depending on the language, this could be an issue where the line above is actually transpiled to be a line below due to inlining in some lambda function or similar.

  • sga@piefed.social
    link
    fedilink
    English
    arrow-up
    10
    ·
    11 hours ago

    in bash if it happens, it often means i have something wrong in most recent closed loop, which may or may not have closed prorperly, somethign similar with python.