修复错误码未注册时, message异常问题

This commit is contained in:
白茶清欢 2023-02-11 23:35:43 +08:00
parent 1ddfbad7da
commit e81729324c
2 changed files with 20 additions and 4 deletions

View File

@ -5,7 +5,7 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="0c7a619f-b520-4d41-ab0d-cfa1799d3cdf" name="Changes" comment=""> <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" /> <change beforePath="$PROJECT_DIR$/code.go" beforeDir="false" afterPath="$PROJECT_DIR$/code.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -19,7 +19,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="GOROOT" url="file://$USER_HOME$/go/go1.17.11" /> <component name="GOROOT" url="file:///usr/local/Cellar/go@1.17/1.17.13/libexec" />
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
@ -34,6 +34,9 @@
<component name="GoLibraries"> <component name="GoLibraries">
<option name="indexEntireGoPath" value="false" /> <option name="indexEntireGoPath" value="false" />
</component> </component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2B4P2ryw4H3y3GlDs3w9wFxFqHs" /> <component name="ProjectId" id="2B4P2ryw4H3y3GlDs3w9wFxFqHs" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
@ -41,7 +44,16 @@
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent"><![CDATA[{
"keyToString": { "keyToString": {
"dart.analysis.tool.window.visible": "false" "RunOnceActivity.go.formatter.settings.were.checked": "true",
"RunOnceActivity.go.migrated.go.modules.settings": "true",
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
"WebServerToolWindowFactoryState": "false",
"dart.analysis.tool.window.visible": "false",
"go.import.settings.migrated": "true",
"last_opened_file_path": "/Users/zhangdeman",
"node.js.detected.package.eslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"vue.rearranger.settings.migration": "true"
} }
}]]></component> }]]></component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
@ -59,4 +71,8 @@
</map> </map>
</option> </option>
</component> </component>
<component name="VgoProject">
<integration-enabled>false</integration-enabled>
<settings-migrated>true</settings-migrated>
</component>
</project> </project>

View File

@ -72,7 +72,7 @@ func getMessage(code interface{}) string {
message, exist := codeTable[code] message, exist := codeTable[code]
if !exist { if !exist {
// 无论是否开启 messageWithCode , 未知错误强行带 code // 无论是否开启 messageWithCode , 未知错误强行带 code
return fmt.Sprintf("未知错误【%v】", codeTable) return fmt.Sprintf("未知错误【%v】", code)
} }
if messageWithCode { if messageWithCode {
if code == defaultSuccessCode { if code == defaultSuccessCode {