From ebeca97f019584573944ae4bf09c50616b5565e7 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 11 Mar 2026 20:35:38 +0000 Subject: 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 LUCI-TryBot-Result: Go LUCI kokoro-CI: kokoro Reviewed-by: Hyang-Ah Hana Kim --- internal/api/types.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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"` +} -- cgit v1.3