cos_gpu_installer: refine error message when latest driver version not found

'--version=latest' is only supported from M93.
Currently cos_gpu_installer returns 404 error
when this flag is used on earlier milestones.
This CL adds a meaningful error message inform users in such case.

BUG=b/210060585

Screenshot of test on M89:
https://screenshot.googleplex.com/5Ud3cgsusqrgBSV

Change-Id: If8e2c3f67e469b50811d71818280b4cc20b57093
Reviewed-on: https://cos-review.googlesource.com/c/cos/tools/+/27520
Cloud-Build: GCB Service account <228075978874@cloudbuild.gserviceaccount.com>
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Tested-by: He Gao <hegao@google.com>
diff --git a/src/cmd/cos_gpu_installer/internal/commands/install.go b/src/cmd/cos_gpu_installer/internal/commands/install.go
index 19a6f70..39bdd1e 100644
--- a/src/cmd/cos_gpu_installer/internal/commands/install.go
+++ b/src/cmd/cos_gpu_installer/internal/commands/install.go
@@ -8,6 +8,7 @@
 	"io/ioutil"
 	"os"
 	"path/filepath"
+	"strconv"
 	"strings"
 	"syscall"
 
@@ -125,10 +126,21 @@
 
 	downloader := cos.NewGCSDownloader(envReader, c.gcsDownloadBucket, c.gcsDownloadPrefix)
 	if c.nvidiaInstallerURL == "" {
+		versionInput := c.driverVersion
+		milestone, err := strconv.Atoi(envReader.Milestone())
+		if err != nil {
+			c.logError(errors.Wrap(err, "failed to parse milestone number"))
+			return subcommands.ExitFailure
+		}
 		c.driverVersion, err = getDriverVersion(downloader, c.driverVersion)
 		if err != nil {
-			c.logError(errors.Wrap(err, "failed to get default driver version"))
-			return subcommands.ExitFailure
+			if versionInput == "latest" && milestone < 93 {
+				c.logError(errors.Wrap(err, "'--version=latest' is only supported on COS M93 and onwards, please unset this flag"))
+				return subcommands.ExitFailure
+			} else {
+				c.logError(errors.Wrap(err, "failed to get default driver version"))
+				return subcommands.ExitFailure
+			}
 		}
 		log.Infof("Installing GPU driver version %s", c.driverVersion)
 	} else {