Skip to content

Instantly share code, notes, and snippets.

@vicyap
Last active January 18, 2020 17:21
Show Gist options
  • Save vicyap/5360540c7ff2805abe8da7ee416156bd to your computer and use it in GitHub Desktop.
Save vicyap/5360540c7ff2805abe8da7ee416156bd to your computer and use it in GitHub Desktop.
catch-all-python-go
package main
import (
"fmt"
)
func main() {
defer func() {
if p := recover(); p != nil {
fmt.Printf("%v\n", p)
}
}()
panic("PANIC!")
}
// $ ./main
// PANIC!
def main():
try:
raise Exception("PANIC!")
except Exception as e:
print(e)
if __name__ == "__main__":
main()
# $ python main.py
# PANIC!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment