JavaScript Error Handling and Tracking Tips and Tricks

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ธ.ค. 2024

ความคิดเห็น • 20

  • @codewithguillaume
    @codewithguillaume ปีที่แล้ว +1

    Thanks for this James :)

  • @ChristianKolbow
    @ChristianKolbow ปีที่แล้ว +1

    I have now also tested highlight. Highlight is really awesome. Great tool

    • @JamesQQuick
      @JamesQQuick  ปีที่แล้ว +1

      It's really pretty incredible!

  • @redblue8389
    @redblue8389 ปีที่แล้ว +1

    Hello James, I saw your video on code academy about vscode. You said that you use mac version of vs code. I have searched alot about this topic but can't seem to find an answer, do you know anyway of how I can use vscode on mac with Windows functionality?

    • @JamesQQuick
      @JamesQQuick  ปีที่แล้ว +1

      What specific windows functionality are you looking for?

    • @redblue8389
      @redblue8389 ปีที่แล้ว

      @@JamesQQuick most of my friends use Windows so I need a Windows system for projects, any Window would be great, I have a mac m1 air...

  • @waldo-the-developer2376
    @waldo-the-developer2376 ปีที่แล้ว +1

    Love it James, thank you so much. Can you make a video on how to handle your errors in a NextJs project?

    • @JamesQQuick
      @JamesQQuick  ปีที่แล้ว +1

      So glad to hear it! Potentially! For the most part it would be the same idea of making sure to use try/catch and handle that way!

  • @ParmpreetNanrhe
    @ParmpreetNanrhe ปีที่แล้ว

    Can you please help me out with setIntervals. when I use interval to run time. when I shift to new tab and leave the tab in which timer is running inactive for a long time. the timer does not move. is there a way to solve this problem

  • @Aquatic2005
    @Aquatic2005 ปีที่แล้ว +1

    One way to handle async errors in express is to wrap the async function in a handler so you can dry up the code and not have to write a try catch every time. Place it in a separate file, then import it into your routes.
    module.exports = func => {
    return (req, res, next) => {
    func(req, res, next).catch(next);
    }
    }
    app.get("/example", asyncHandler(async (req, res) => {res.send("Example")}))

    • @JamesQQuick
      @JamesQQuick  ปีที่แล้ว +1

      Yep, that's a good option. The downside is you lack specific logging info if you have one generic handler.

    • @Aquatic2005
      @Aquatic2005 ปีที่แล้ว +1

      @@JamesQQuick thats true, I forgot to add that you can get specific logging info in express by adding in this with the above async handling example.
      app.use((err, req, res, next) => {
      console.log(err);
      next();
      });
      Depending on what I need I will render a error page while logging the specific issue
      app.use((err, req, res, next) => {
      const { statusCode = 500, message = "Someting Went Wrong, Try Again!" } = err;
      res.status(statusCode).render("error", { message, statusCode });
      console.log(err)
      next();
      });
      Good point though, I forgot about the rest of this I usually pair with the aforementioned async handler.

  • @christopheanfry
    @christopheanfry ปีที่แล้ว

    Thank you very useful topic!!!

  • @DeineWebschmiede
    @DeineWebschmiede ปีที่แล้ว

    thank you for this video, very informative

  • @keeprunning5457
    @keeprunning5457 ปีที่แล้ว

    nice man keep em coming jajaja

  • @elmalleable
    @elmalleable ปีที่แล้ว

    Me that just duelled the analytics beast to tag my errors

  • @AngelEduardoLopezZambrano
    @AngelEduardoLopezZambrano ปีที่แล้ว

    Nice video, very informative! I haven't looked into error handling too deep, this a good starting point. Thanks