Python try except Translated to Golang Synonyms


Synonyms - Python try-except translated to Golang (Go programming language).

Python:

try:
    one()
    two()
    three()
except:
    handler()

Go:

func main() {
      defer func() {
              e := recover()
              if e != nil {
                      handler()
              }
      }()
      one()
      two()
      three()
}

I believe the original version comes from [3], but the post seems to be missing.


References:

[1]
[2]HTML5note/go笔记.txt at master · summerworm/HTML5note · GitHub
[3]科技博 on Twitter: "Golang Go语言中的try ... except ...统一的异常处理: 写python的时候,有时候懒得一个一个错误去分别处理,直接使用一个整体来try catch来捕获所有异常。 http://tinyurl.com/3ruyctw
[4]