func UnaryServerInterceptor() grpc.UnaryServerInterceptor {
	return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
		res, err := handler(ctx, req)
		if ttnErr, ok := From(err); ok {
			err = ttnErr
		}
		return res, err
	}
}
UnaryServerInterceptor makes sure that returned TTN errors contain a CorrelationID.
package errors
import (
	"context"
	"github.com/golang/protobuf/proto"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)
func FromGRPCStatus(status *status.Status) *Error {
	err := build(&Definition{
		code:          uint32(status.Code()),
		messageFormat: status.Message(),
	}, 0)
	if ErrorDetailsFromProto == nil {
		return err
	}
	detailMsgs := status.Details()
	detailProtos := make([]proto.Message, 0, len(detailMsgs))
	for _, msg := range detailMsgs {  
		if msg, ok := msg.(proto.Message); ok {
			detailProtos = append(detailProtos, msg)
		}
	}
	details, rest := ErrorDetailsFromProto(detailProtos...)
	if len(rest) != 0 {
		err.details = rest
	}
	if details != nil {
		setErrorDetails(err, details)
	}
	return err
}
var ErrorDetailsToProto func(e ErrorDetails) (msg proto.Message)
var ErrorDetailsFromProto func(msg ...proto.Message) (details ErrorDetails, rest []proto.Message)
func (d *Definition) setGRPCStatus() {
	s := status.New(codes.Code(d.Code()), d.String())
	if ErrorDetailsToProto != nil {
		if pb := ErrorDetailsToProto(d); pb != nil {
			var err error
			s, err = s.WithDetails(pb)
			if err != nil {
				panic(err)  
			}
		}
	}
	d.grpcStatus = s
}
func (d *Definition) GRPCStatus() *status.Status {
	if d == nil {
		return nil
	}
	return d.grpcStatus  
}
func (e *Error) clearGRPCStatus() {
	e.grpcStatus.Store((*status.Status)(nil))
}
func (e *Error) GRPCStatus() *status.Status {
	if s, ok := e.grpcStatus.Load().(*status.Status); ok && s != nil {
		return s
	}
	s := status.New(codes.Code(e.Code()), e.String())
	if ErrorDetailsToProto != nil {
		if pb := ErrorDetailsToProto(e); pb != nil {
			var err error
			s, err = s.WithDetails(pb)
			if err != nil {
				panic(err)  
			}
		}
	}
	e.grpcStatus.Store(s)
	return s
}