升级异常实例化

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

@ -4,9 +4,7 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="0c7a619f-b520-4d41-ab0d-cfa1799d3cdf" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/exception.go" beforeDir="false" afterPath="$PROJECT_DIR$/exception.go" afterDir="false" />
</list>
<list default="true" id="0c7a619f-b520-4d41-ab0d-cfa1799d3cdf" name="Changes" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />

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{}{}