mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
fix(xerror): [xerror] drop leading ": " when message is empty (#423)
* fix(xerror): [xerror] drop leading ": " when message is empty * test(xerror): [xerror] cover Wrap without a message
This commit is contained in:
1 parent
afc0d3c676
commit
0eabb67ed4
2 files changed
+16
No files matched your search
@@ -87,6 +87,10 @@ func (e *XError) Error() string {
|
||||
return msg
|
||||
}
|
||||
|
||||
if msg == "" {
|
||||
return cause.Error()
|
||||
}
|
||||
|
||||
msg = fmt.Sprintf("%s: %v", msg, cause.Error())
|
||||
|
||||
return msg
|
||||
|
||||
Reference in new issue
Block a user