How to EFFICIENTLY Handle Errors in Golang APIs

Sdílet
Vložit
  • čas přidán 16. 06. 2024
  • ► Join the private community to level up as software engineer: selfmadeengineer.com
    In this video will show how you can handle errors in your Golang APIs while being pragmatic and as practical as possible, so you can focus in what really matters: building stuff.
    👉 Join the private community to level up as software engineer: selfmadeengineer.com
    📢 We're building a Discord community, come and join
    / discord
    💻 Check the "Complete Backend API in Golang" Course: • Complete Backend API i...
    🌱 Check the "Golang Essentials" Playlist here: • Advanced Golang
    #golang #go #api

Komentáře • 20

  • @prashlovessamosa
    @prashlovessamosa Před 2 měsíci +3

    Thanks Tiago
    I had some confusion
    video is super helpful thanks
    Keep up the good work

  • @jameleddinelassoued7228
    @jameleddinelassoued7228 Před 2 měsíci +1

    Thanks Tiago another awesome video!

  • @saurontrollbrawl
    @saurontrollbrawl Před 2 měsíci +1

    Thanks man!!!!!

  • @selvamp5775
    @selvamp5775 Před 2 měsíci +1

    Very informative..

  • @afsdab
    @afsdab Před měsícem

    Great!

  • @David-xy4nw
    @David-xy4nw Před měsícem +1

    One thing that I wanted to mention regarding the "other solution"
    When you are saying that the method where you return errors directly from the handler and wrapping a middleware around it does not make sense and the reasoning behind that is the custom error codes and error messages. You can do the following, create a struct like APIError for example and implement an Error method for it, it would act as an error and that struct would have the original error, message and status code inside it (whatever data you would need) and basically inside the middleware you'll just do the json encoding of that struct and thats it. You essentially achieve the same thing with the fewer lines of code inside the handler, and I personally think it is better approach then doing writejson with return on every code block.

    • @TiagoTaquelim
      @TiagoTaquelim  Před měsícem

      Yhea that sounds like a good solution as well, thanks!

  • @eligbuefelix7988
    @eligbuefelix7988 Před 2 měsíci +1

    Thanks alot

  • @samsrec6060
    @samsrec6060 Před 2 měsíci +4

    Please make an fullstack application using go. Thank for this.

    • @selvamp5775
      @selvamp5775 Před 2 měsíci

      Is it possible to create fullstack application using Go + template. Or need to use frontend frameworks.

    • @TiagoTaquelim
      @TiagoTaquelim  Před 2 měsíci +2

      I've made it already! czcams.com/video/yqDYYjbatfE/video.html

    • @selvamp5775
      @selvamp5775 Před 2 měsíci

      Thanks..

    • @TiagoTaquelim
      @TiagoTaquelim  Před 2 měsíci

      @@selvamp5775 You can!

    • @racapella
      @racapella Před 2 měsíci

      do you have one using htmx too@@TiagoTaquelim

  • @AllAboutCode
    @AllAboutCode Před 2 měsíci

    Great video,
    Can you like create a video on deploying golang apis

  • @meuscc
    @meuscc Před 2 měsíci

    除了错误处理极为极为极为丑陋 go 的其他都很nice

  • @ruirodrigues3725
    @ruirodrigues3725 Před 2 měsíci +1

    Segues o Anthony GG? Parece uma resposta a um dos videos dele: czcams.com/video/g-gsmike7qc/video.html

    • @TiagoTaquelim
      @TiagoTaquelim  Před 2 měsíci +2

      Sim! Gosto imenso do trabalho dele! Este video não é uma resposta, eu considerei o ponto de vista dele como uma solução valida.