2021-09-12 23:24:22 +03:00
|
|
|
package drpc
|
|
|
|
|
|
|
|
import (
|
2021-10-27 18:13:33 +03:00
|
|
|
"go.unistack.org/micro/v3/errors"
|
2021-09-12 23:24:22 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func microError(err error) error {
|
|
|
|
// no error
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if verr, ok := err.(*errors.Error); ok {
|
|
|
|
return verr
|
|
|
|
}
|
|
|
|
|
|
|
|
// fallback
|
|
|
|
return &errors.Error{
|
2021-10-29 00:00:46 +03:00
|
|
|
ID: "go.micro.client",
|
2021-09-12 23:51:45 +03:00
|
|
|
Code: 500,
|
|
|
|
Detail: err.Error(),
|
|
|
|
// Status: http.StatusInternalServerError,
|
2021-09-12 23:24:22 +03:00
|
|
|
}
|
|
|
|
}
|