mirror of
https://github.com/go-kratos/kratos.git
synced 2026-05-22 10:15:24 +02:00
fix(errors): code error (#1394)
This commit is contained in:
+2
-2
@@ -75,7 +75,7 @@ func Code(err error) int {
|
||||
if err == nil {
|
||||
return 200
|
||||
}
|
||||
if se := FromError(err); err != nil {
|
||||
if se := FromError(err); se != nil {
|
||||
return int(se.Code)
|
||||
}
|
||||
return UnknownCode
|
||||
@@ -84,7 +84,7 @@ func Code(err error) int {
|
||||
// Reason returns the reason for a particular error.
|
||||
// It supports wrapped errors.
|
||||
func Reason(err error) string {
|
||||
if se := FromError(err); err != nil {
|
||||
if se := FromError(err); se != nil {
|
||||
return se.Reason
|
||||
}
|
||||
return UnknownReason
|
||||
|
||||
Reference in New Issue
Block a user