core/internal/api: use gRPC statuses as much as possible

Returning plain go errors via gRPC will always result in a gRPC 'INTERNAL' error code, which is suboptimal. We go ahead and semanticize some of the possible error paths, and at the same time:

 - swallow some internal errors into logs and serve sanitized errors
 - move some of the internal service implementations to also use gRPC statuses
 - change a panic() call into a status.Unimplemented return type

There's still plenty work to be done on this front, but this is a good first change.

Test Plan: if this is not covered by tests we're screwed anyways

X-Origin-Diff: phab/D366
GitOrigin-RevId: 71880a9e23c65631d6c4df6338855864c34bb11f
diff --git a/core/internal/node/setup.go b/core/internal/node/setup.go
index 98873d3..285046a 100644
--- a/core/internal/node/setup.go
+++ b/core/internal/node/setup.go
@@ -20,18 +20,18 @@
 	"git.monogon.dev/source/nexantic.git/core/generated/api"
 	"git.monogon.dev/source/nexantic.git/core/internal/common"
 	"git.monogon.dev/source/nexantic.git/core/internal/storage"
-
-	"errors"
+	"google.golang.org/grpc/codes"
+	"google.golang.org/grpc/status"
 
 	"go.uber.org/zap"
 )
 
 var (
-	ErrConsensusAlreadyProvisioned = errors.New("consensus is already provisioned; make sure the data folder is empty")
-	ErrAlreadySetup                = errors.New("node is already set up")
-	ErrNotInJoinMode               = errors.New("node is not in the cluster join mode")
-	ErrTrustNotInitialized         = errors.New("trust backend not initialized")
-	ErrStorageNotInitialized       = errors.New("storage not initialized")
+	ErrConsensusAlreadyProvisioned = status.Error(codes.FailedPrecondition, "consensus is already provisioned; make sure the data folder is empty")
+	ErrAlreadySetup                = status.Error(codes.FailedPrecondition, "node is already set up")
+	ErrNotInJoinMode               = status.Error(codes.FailedPrecondition, "node is not in the cluster join mode")
+	ErrTrustNotInitialized         = status.Error(codes.FailedPrecondition, "trust backend not initialized")
+	ErrStorageNotInitialized       = status.Error(codes.FailedPrecondition, "storage not initialized")
 )
 
 func (s *SmalltownNode) CurrentState() common.SmalltownState {