From eab2d2eeaa92e77c8ee458f3ea01b724a2e8e89f Mon Sep 17 00:00:00 2001 From: tursom Date: Mon, 5 Jul 2021 15:51:53 +0800 Subject: [PATCH] add PackagePanic --- exceptions/Exception.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/exceptions/Exception.go b/exceptions/Exception.go index d308767..1afcfd3 100644 --- a/exceptions/Exception.go +++ b/exceptions/Exception.go @@ -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, + ) + } +}