internal/frontend: improve error message for proxydatasource

When an endpoint is not supported by the proxydatasource, we now return
a message letting the user know that is the case.

Change-Id: I2c5cf3a03e8aa43d72c3599fc37c47da20756e9c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238977
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/frontend/details.go b/internal/frontend/details.go
index 1a33ec1..2b41b6b 100644
--- a/internal/frontend/details.go
+++ b/internal/frontend/details.go
@@ -294,6 +294,15 @@
 	}
 }
 
+func proxydatasourceNotSupportedErr() error {
+	return &serverError{
+		status: http.StatusFailedDependency,
+		epage: &errorPage{
+			Message: "This page is not supported by the proxydatasource.",
+		},
+	}
+}
+
 func parseStdLibURLPath(urlPath string) (path, version string, err error) {
 	defer derrors.Wrap(&err, "parseStdLibURLPath(%q)", urlPath)
 
diff --git a/internal/frontend/package.go b/internal/frontend/package.go
index ff58e95..ba1730a 100644
--- a/internal/frontend/package.go
+++ b/internal/frontend/package.go
@@ -193,7 +193,7 @@
 	}
 	db, ok := s.ds.(*postgres.DB)
 	if !ok {
-		return "", &serverError{status: http.StatusFailedDependency}
+		return "", proxydatasourceNotSupportedErr()
 	}
 	matches, err := db.GetStdlibPathsWithSuffix(ctx, shortcut)
 	if err != nil {
diff --git a/internal/frontend/search.go b/internal/frontend/search.go
index 6393271..badd5bd 100644
--- a/internal/frontend/search.go
+++ b/internal/frontend/search.go
@@ -106,7 +106,7 @@
 	db, ok := s.ds.(*postgres.DB)
 	if !ok {
 		// The proxydatasource does not support the imported by page.
-		return &serverError{status: http.StatusFailedDependency}
+		return proxydatasourceNotSupportedErr()
 	}
 
 	ctx := r.Context()
diff --git a/internal/frontend/tabs.go b/internal/frontend/tabs.go
index 30d8797..266bb2d 100644
--- a/internal/frontend/tabs.go
+++ b/internal/frontend/tabs.go
@@ -156,7 +156,7 @@
 		db, ok := ds.(*postgres.DB)
 		if !ok {
 			// The proxydatasource does not support the imported by page.
-			return nil, &serverError{status: http.StatusFailedDependency}
+			return nil, proxydatasourceNotSupportedErr()
 		}
 		return fetchImportedByDetails(ctx, db, pkg.Path, pkg.ModulePath)
 	case "licenses":
@@ -184,7 +184,7 @@
 		db, ok := ds.(*postgres.DB)
 		if !ok {
 			// The proxydatasource does not support the imported by page.
-			return nil, &serverError{status: http.StatusFailedDependency}
+			return nil, proxydatasourceNotSupportedErr()
 		}
 		return fetchImportedByDetails(ctx, db, vdir.Path, vdir.ModulePath)
 	case "licenses":