add PackagePanic

This commit is contained in:
tursom 2021-07-05 15:51:53 +08:00
parent d257299449
commit eab2d2eeaa

View File

@ -106,3 +106,20 @@ func PackageAny(err interface{}) Exception {
return NewRuntimeException(err, "", true, nil)
}
}
func PackagePanic(panic interface{}) Exception {
switch panic.(type) {
case error:
return NewRuntimeException(
panic,
"an panic caused on handle WebSocket message:",
true, panic,
)
default:
return NewRuntimeException(
panic,
"an panic caused on handle WebSocket message:",
true, nil,
)
}
}