2021-02-22 00:52:18 +03:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/unistack-org/micro/v3/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestError(t *testing.T) {
|
|
|
|
e := NewError("svc1")
|
|
|
|
err := e.BadRequest("%s", "test")
|
|
|
|
merr, ok := err.(*errors.Error)
|
|
|
|
if !ok {
|
|
|
|
t.Fatal("error not *errors.Error")
|
|
|
|
}
|
2021-09-30 21:00:02 +03:00
|
|
|
if merr.ID != "svc1" {
|
2021-02-22 00:52:18 +03:00
|
|
|
t.Fatal("id != svc1")
|
|
|
|
}
|
|
|
|
}
|