Improve 'shouldn't ever happen' error messages

This commit is contained in:
Alan Bernstein 2020-07-22 16:36:02 -05:00
parent fd65384faa
commit fa77a36e83

View file

@ -1078,7 +1078,7 @@ func (srv *Server) StartTransaction(ctx context.Context, id string, timeout time
return nil, ErrNodeNotCoordinator
}
if remote && (node.IsCoordinator || len(srv.cluster.Nodes()) == 1) {
return nil, errors.New("got a remote start call to coordinator or single node cluster... shouldn't ever happen")
return nil, errors.New("unexpected remote start call to coordinator or single node cluster")
}
if remote {
@ -1124,7 +1124,7 @@ func (srv *Server) FinishTransaction(ctx context.Context, id string, remote bool
return nil, ErrNodeNotCoordinator
}
if remote && (node.IsCoordinator || len(srv.cluster.Nodes()) == 1) {
return nil, errors.New("got a remote finish call to coordinator or single node cluster... shouldn't ever happen")
return nil, errors.New("unexpected remote finish call to coordinator or single node cluster")
}
if remote {
@ -1163,7 +1163,7 @@ func (srv *Server) GetTransaction(ctx context.Context, id string, remote bool) (
}
if remote && (node.IsCoordinator || len(srv.cluster.Nodes()) == 1) {
return nil, errors.New("got a remote finish call to coordinator or single node cluster... shouldn't ever happen")
return nil, errors.New("unexpected remote get call to coordinator or single node cluster")
}
trns, err := srv.holder.GetTransaction(ctx, id)