001: Error handling in Go - podcast episode cover

001: Error handling in Go

Jan 10, 202217 minEp. 1
--:--
--:--
Listen in podcast apps:
Metacast
Spotify
Youtube
RSS

Episode description

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.

For the best experience, listen in Metacast app for iOS or Android
Open in Metacast
001: Error handling in Go | go podcast() - Listen or read transcript on Metacast