github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/recover12a.gno (about) 1 package main 2 3 func anotherRecover() { 4 if r := recover(); r != nil { 5 println(r) 6 } 7 } 8 9 func main() { 10 defer func() { 11 if r := recover(); r != nil { 12 println(r) 13 } 14 }() 15 defer anotherRecover() 16 defer func() { 17 if r := recover(); r != nil { 18 panic("panic in defer func") 19 } 20 }() 21 22 panic("panic in main") 23 } 24 25 // Output: 26 // panic in defer func