You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
576 B
Go
24 lines
576 B
Go
2 years ago
|
package health
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/ajikamaludin/go-grpc_basic/pkg/v1/utils/errors"
|
||
|
hlpb "github.com/ajikamaludin/go-grpc_basic/proto/v1/health"
|
||
|
"github.com/golang/protobuf/ptypes/empty"
|
||
|
"google.golang.org/grpc/codes"
|
||
|
)
|
||
|
|
||
|
func (s *Server) CallCustomError(ctx context.Context, req *empty.Empty) (*hlpb.Response, error) {
|
||
|
|
||
|
// return nil, errors.FormatError(codes.NotFound, &errors.Response{
|
||
|
// Code: "404",
|
||
|
// Msg: "Not Found",
|
||
|
// })
|
||
|
|
||
|
return nil, errors.FormatError(codes.Unauthenticated, &errors.Response{
|
||
|
Code: "401",
|
||
|
Msg: "User not found",
|
||
|
})
|
||
|
}
|