升级异常实例化

This commit is contained in:
2022-06-26 12:57:36 +08:00
parent 282f54bb73
commit 12de75ae4b
2 changed files with 4 additions and 6 deletions

View File

@ -47,7 +47,7 @@ func (e *Exception) GetHttpCode() int {
//
// Date : 21:22 2022/6/25
func NewWithCode(code interface{}) *Exception {
return New(code, defaultHttpCode, map[string]interface{}{})
return New(code, defaultHttpCode, nil)
}
// NewWithCodeAndHttpCode 使用 code + http_code 获取实例
@ -64,7 +64,7 @@ func NewWithCodeAndHttpCode(code interface{}, httpCode int) *Exception {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 21:28 2022/6/25
func NewWithCodeAndData(code interface{}, data map[string]interface{}) *Exception {
func NewWithCodeAndData(code interface{}, data interface{}) *Exception {
return New(code, defaultHttpCode, data)
}
@ -73,7 +73,7 @@ func NewWithCodeAndData(code interface{}, data map[string]interface{}) *Exceptio
// Author : go_developer@163.com<白茶清欢>
//
// Date : 21:28 2022/6/25
func New(code interface{}, httpCode int, data map[string]interface{}) *Exception {
func New(code interface{}, httpCode int, data interface{}) *Exception {
if nil == data {
// 保证数据结构的一致性, 同时避免后续使用出现空指针
data = map[string]interface{}{}