package app import ( "errors" "evening_detective_server/internal/services/game_service" "evening_detective_server/internal/services/scenarios_service" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) func gameErrorStatus(err error, internalMessage string) error { switch { case errors.Is(err, game_service.ErrGameNotFound), errors.Is(err, scenarios_service.ErrScenarioNotFound): return status.Error(codes.NotFound, err.Error()) case errors.Is(err, game_service.ErrInvalidGameFormat): return status.Error(codes.InvalidArgument, err.Error()) default: return status.Error(codes.Internal, internalMessage) } }