16

Dear JavaScript,

"TypeError: Object(...)(...) is undefined" is not a helpful error message.

Sincerely,

Me

Comments
  • 1
    Oh god debugging JavaScript. Easily the worst thing I’ve had to do as a dev. Complain all you want about c++ errors, at least it actually gives you something to work with. JavaScript errors means an hour or two of debugging with no help from the interpreter
  • 1
    you should try

    console.log(typeof null);
  • 1
    @10Dev debugging javascript is hours of pain...debugging front end in general
  • 1
    undefined
  • 4
    But you guys know that there is a so called stack trace? Telling you exactly where the error originated from.
  • 1
    @nitwhiz Exactly! Thanks for pointing this out.
  • 1
    As @nitwhiz said. You look at stack trace, use a proper debugger and step back/forward. You'll soon know that the script itself is just a minified piece of shit if you can't debug it even with these powerful devtools.
  • 1
    Thats happens when you try to access multi-level object and its not even there.
  • 0
    Convert to typescript then 🤷🏼‍♀️ then you’ll have more info
  • 1
    @bashleigh TS also produces some wildly unhelpful error messages though. Granted, it’s a mountain of an improvement from JS
  • 0
    @ostream Don't entangle me in frameworks bs. Tools are just fine. I was talking more about the choices made *before* you that led to debugging, like someone not following the docs and writing total mess.
    Debugging becomes an opt-in if TypeScript is in place 👌
Add Comment