Artwork

Content provided by Dominic St-Pierre. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Dominic St-Pierre or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

001: Error handling in Go

16:44
 
Share
 

Manage episode 317183431 series 3302141
Content provided by Dominic St-Pierre. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Dominic St-Pierre or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

Example of not using the happy path at 1st indentation:

try {
if (user.HasAccessTo(Admin) {
if (somethingElse()) {
// happy path
}
else {}
}
else {}
}
catch(Exception ex) {
// what really happened, and where?
}

An example of happy path in idiomatic Go:

ok, error := hasAccessTo(user, ADMIN)
if err != nil || !ok {
// handle not access
}

if !somethingElse() {
// handle something else false
}
// Happy path

My course on building SaaS apps in Go.

  continue reading

42 episodes

Artwork

001: Error handling in Go

go podcast()

26 subscribers

published

iconShare
 
Manage episode 317183431 series 3302141
Content provided by Dominic St-Pierre. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Dominic St-Pierre or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

Example of not using the happy path at 1st indentation:

try {
if (user.HasAccessTo(Admin) {
if (somethingElse()) {
// happy path
}
else {}
}
else {}
}
catch(Exception ex) {
// what really happened, and where?
}

An example of happy path in idiomatic Go:

ok, error := hasAccessTo(user, ADMIN)
if err != nil || !ok {
// handle not access
}

if !somethingElse() {
// handle something else false
}
// Happy path

My course on building SaaS apps in Go.

  continue reading

42 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide