浅色圆锥曲线爱好者PostsNotesAbout

mercari.go #11

better go error handling in go

status in other langs

java => has issues js => ignored c++ => dark corners go => "ok()"

  • no performance problems
  • can't ignore
  • just values
  • annoy?

just errors

=> if err != nil

improve+

  • wrapper errors
  • customs struct
  • building and clearning stacktrace

improve++

http => not string matching domain error struct

kind : NotAvaliable | NotFound | NotAllowed | Unknown

go
type Error stuct {
Op Op
Kind int
}

=> verbose

return nil, E(...)

make all application can understanderror

  • decouple gRPC <-> http server

error is your domain

localized message codes

  • from ?

  • operation ?

  • resources ?

  • cause ?

  • severity / logging ?

  • clinent message ?

  • ...(dev/prod)

  • ...(localizes)

  • ...(translate)

  • ... etc

introduction to singleflight

slide

fabio

net/lookup

net/lookup

isucon

file

© 2023