How to EFFICIENTLY Handle Errors in Golang APIs

Поділитися
Вставка
  • Опубліковано 23 сер 2024

КОМЕНТАРІ • 20

  • @prashlovessamosa
    @prashlovessamosa 4 місяці тому +3

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

  • @David-xy4nw
    @David-xy4nw 3 місяці тому +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  3 місяці тому

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

  • @jameleddinelassoued7228
    @jameleddinelassoued7228 4 місяці тому +1

    Thanks Tiago another awesome video!

  • @samsrec6060
    @samsrec6060 4 місяці тому +4

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

    • @selvamp5775
      @selvamp5775 4 місяці тому

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

    • @TiagoTaquelim
      @TiagoTaquelim  4 місяці тому +2

      I've made it already! ua-cam.com/video/yqDYYjbatfE/v-deo.html

    • @selvamp5775
      @selvamp5775 4 місяці тому

      Thanks..

    • @TiagoTaquelim
      @TiagoTaquelim  4 місяці тому

      @@selvamp5775 You can!

    • @racapella
      @racapella 4 місяці тому

      do you have one using htmx too@@TiagoTaquelim

  • @saurontrollbrawl
    @saurontrollbrawl 4 місяці тому +1

    Thanks man!!!!!

  • @selvamp5775
    @selvamp5775 4 місяці тому +1

    Very informative..

  • @eligbuefelix7988
    @eligbuefelix7988 4 місяці тому +1

    Thanks alot

  • @afsdab
    @afsdab 4 місяці тому

    Great!

  • @meuscc
    @meuscc 4 місяці тому

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

  • @AllAboutCode
    @AllAboutCode 4 місяці тому

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

    • @TiagoTaquelim
      @TiagoTaquelim  4 місяці тому

      I have one on my channel with GCP.

    • @TiagoTaquelim
      @TiagoTaquelim  4 місяці тому

      Not Golang specific. But can work as well.

  • @ruirodrigues3725
    @ruirodrigues3725 4 місяці тому +1

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

    • @TiagoTaquelim
      @TiagoTaquelim  4 місяці тому +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.