Golang Microservices: Working and Dealing with Errors

Опубликовано: 23 Март 2021
на канале: Mario Carrion
4k
121

In this video I share with you the approach I like to take and the best practices I follow when implementing domain errors in Go/Golang using the Hexagonal Architecture and writing idiomatic code:

* How to implement new errors
* How to deal with errors
* How to wrap errors
* How to define concrete codes to determine where errors come from

All of that using the new API introduced by Go 1.13:

* errors.Is
* errors.As
* errors.Unwrap

And the new verb added to the fmt package called %w.

This is the first of a series where I will cover more things related working with errors and dealing with failures where I'm planning to cover:
* Observability using OpenTelemetry
* Observability using NewRelic
* Resilience via Retries, Backoff algorithms and Circuit Breaking.

* Example code:
* Blog post:

* Previous episode: "Building Microservices in Golang: REST APIs - Versioning Techniques"
* Playlist "Golang/Go Tools and Packages":
* Playlist "Building Microservices in Go/Golang":
* Playlist "Golang/Go Testing":

00:00 Start
00:10 Agenda
00:40 Errors in Go 1.13
04:07 Other resources
06:23 Demo: project structure
07:34 Demo: implementing errors
08:23 Demo: errors in domain package
09:19 Demo: errors in PostgreSQL repository package
10:01 Demo: errors in service package
10:17 Demo: errors in rest package
11:27 Demo: connecting everything using swagger-ui
13:13 Demo: recap
14:30 Parting words

---

Who am I:

Hello! I'm Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I've learned while working for small startups and large companies including the processes I've followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don't give up!



--- Our affiliate links below

Shop our favorite products →
Vlogging setup →
Shop now and save at BestBuy →
DJI Osmo Action, Unleash Your Other Side →
Get a 30 day FREE trial of Epidemic Sound →
Try Amazon Prime 30-Day FREE trial →
I love getting Cash Back and think you will too! Join for free and get $20 when you spend $20 →
Sign up to start using vidIQ to grow your YouTube channel for FREE →

--- Our Vlog Channel


Смотрите видео Golang Microservices: Working and Dealing with Errors онлайн без регистрации, длительностью 15 минут 59 секунд в хорошем hd качестве. Это видео добавил пользователь Mario Carrion 23 Март 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 4 тысяч раз и оно понравилось 121 людям.