diff --git a/exceptions/Exception.go b/exceptions/Exception.go index 484bade..aab0937 100644 --- a/exceptions/Exception.go +++ b/exceptions/Exception.go @@ -80,5 +80,6 @@ func Print(err error) { err.(Exception).PrintStackTrace() default: _, _ = fmt.Fprintln(os.Stderr, err) + PrintStackTraceByArray(os.Stderr, GetStackTrace()) } } diff --git a/exceptions/RuntimeException.go b/exceptions/RuntimeException.go index 3184b3b..5bcfb01 100644 --- a/exceptions/RuntimeException.go +++ b/exceptions/RuntimeException.go @@ -14,6 +14,14 @@ type RuntimeException struct { cause Exception } +func Package(err error) *RuntimeException { + if err == nil { + return nil + } + runtimeException := NewRuntimeException(err, "", true, err) + return &runtimeException +} + func NewRuntimeException(message interface{}, exceptionMessage string, getStackTrace bool, cause interface{}) RuntimeException { var stackTrace []StackTrace = nil if getStackTrace {