aboutsummaryrefslogtreecommitdiff
path: root/internal/api/types.go
diff options
context:
space:
mode:
authorEthan Lee <ethanalee@google.com>2026-03-24 19:38:01 +0000
committerGopher Robot <gobot@golang.org>2026-04-01 19:31:36 -0700
commitaed8d2b9be2361625f8b305b91885f7c1a710f07 (patch)
treedf22774ab6ab9d87ec06e37af69aa1ff186d3a3a /internal/api/types.go
parent50f3e086f52d8af852dacd214738f8f83a9007aa (diff)
downloadgo-x-pkgsite-aed8d2b9be2361625f8b305b91885f7c1a710f07.tar.xz
internal/api: consolidate error response handling for all handlers
- Ensure that all errors are wrapped correctly and served as a json error response. Change-Id: I588552c755fb2135916da95dec6d37238d030d39 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758821 Auto-Submit: Ethan Lee <ethanalee@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'internal/api/types.go')
-rw-r--r--internal/api/types.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/api/types.go b/internal/api/types.go
index 92569ab1..6af65e58 100644
--- a/internal/api/types.go
+++ b/internal/api/types.go
@@ -92,6 +92,10 @@ type Error struct {
Candidates []Candidate `json:"candidates,omitempty"`
}
+func (e *Error) Error() string {
+ return e.Message
+}
+
// Candidate is a potential resolution for an ambiguous path.
type Candidate struct {
ModulePath string `json:"modulePath"`