aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Lee <ethanalee@google.com>2026-03-11 20:35:38 +0000
committerGopher Robot <gobot@golang.org>2026-03-11 19:16:34 -0700
commitebeca97f019584573944ae4bf09c50616b5565e7 (patch)
tree3141adbca4328bfa8558da33d47d509c043c95dd
parent59cb58a646844f6fba00bfadc39b4bea96357358 (diff)
downloadgo-x-pkgsite-ebeca97f019584573944ae4bf09c50616b5565e7.tar.xz
internal/api: add error type
- This new error type should also capture alternative candidates given an ambiguous package path. Change-Id: I748cecdcc9d7656d4ea4d148dff090e230676f08 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754500 Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
-rw-r--r--internal/api/types.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/api/types.go b/internal/api/types.go
index 563cbb3b..8b6e4941 100644
--- a/internal/api/types.go
+++ b/internal/api/types.go
@@ -84,3 +84,16 @@ type Vulnerability struct {
Details string `json:"details"`
FixedVersion string `json:"fixedVersion"`
}
+
+// Error contains detailed information about an error.
+type Error struct {
+ Code int `json:"code"`
+ Message string `json:"message"`
+ Candidates []Candidate `json:"candidates,omitempty"`
+}
+
+// Candidate represents a potential resolution for an ambiguous path.
+type Candidate struct {
+ ModulePath string `json:"modulePath"`
+ PackagePath string `json:"packagePath"`
+}