ShadowEditor/server/test/panic/panic2err_test.go
2020-05-13 21:40:58 +08:00

25 lines
256 B
Go

package panic
import (
"fmt"
"testing"
)
func TestPanic2Err(t *testing.T) {
CatchFunc()
}
func CatchFunc() {
defer func() {
if r := recover(); r != nil {
fmt.Print(r)
}
}()
PanicFunc()
}
func PanicFunc() {
panic("Something is wrong!")
}