mirror of
https://github.com/tursom/GoCollections.git
synced 2025-03-28 05:30:09 +08:00
update NewRuntimeException
This commit is contained in:
parent
a30503aa6a
commit
aad1925a1c
@ -13,7 +13,7 @@ type RuntimeException struct {
|
|||||||
cause Exception
|
cause Exception
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRuntimeException(message, exceptionMessage string, getStackTrace bool, cause Exception) RuntimeException {
|
func NewRuntimeException(message, exceptionMessage string, getStackTrace bool, cause interface{}) RuntimeException {
|
||||||
var stackTrace []StackTrace = nil
|
var stackTrace []StackTrace = nil
|
||||||
if getStackTrace {
|
if getStackTrace {
|
||||||
stackTrace = GetStackTrace()
|
stackTrace = GetStackTrace()
|
||||||
@ -23,11 +23,17 @@ func NewRuntimeException(message, exceptionMessage string, getStackTrace bool, c
|
|||||||
exceptionMessage = "exception caused:"
|
exceptionMessage = "exception caused:"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var causeException Exception = nil
|
||||||
|
switch cause.(type) {
|
||||||
|
case Exception:
|
||||||
|
causeException = cause.(Exception)
|
||||||
|
}
|
||||||
|
|
||||||
return RuntimeException{
|
return RuntimeException{
|
||||||
message: message,
|
message: message,
|
||||||
exceptionMessage: exceptionMessage,
|
exceptionMessage: exceptionMessage,
|
||||||
stackTrace: stackTrace,
|
stackTrace: stackTrace,
|
||||||
cause: cause,
|
cause: causeException,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user