github.com/searKing/golang/go@v1.2.74/error/exception/exception.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package exception 6 7 type Exception struct { 8 *ThrowableObject 9 } 10 11 func NewException() *Exception { 12 return &Exception{ 13 ThrowableObject: NewThrowable(), 14 } 15 } 16 17 func NewException1(message string) *Exception { 18 return &Exception{ 19 ThrowableObject: NewThrowable1(message), 20 } 21 } 22 23 func NewException2(message string, cause Throwable) *Exception { 24 return &Exception{ 25 ThrowableObject: NewThrowable2(message, cause), 26 } 27 } 28 29 func NewException4(message string, cause Throwable, enableSuppression, writableStackTrace bool) *Exception { 30 return &Exception{ 31 ThrowableObject: NewThrowable4(message, cause, enableSuppression, writableStackTrace), 32 } 33 }