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
Watch video Golang Microservices: Working and Dealing with Errors online without registration, duration 15 minute 59 second in high hd quality. This video was added by user Mario Carrion 23 March 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4 thousand once and liked it 121 people.