From 6c68d390815732a0ed437cedaf4d19496d7378c8 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 1 Aug 2024 01:06:02 +0300 Subject: [PATCH] errors: add RFC9457 problem type closes #297 Signed-off-by: Vasiliy Tolstov --- errors/errors.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/errors/errors.go b/errors/errors.go index b59034e6..3224515d 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -44,6 +44,20 @@ var ( ErrGatewayTimeout = &Error{Code: 504} ) +const ProblemContentType = "application/problem+json" + +type Problem struct { + Type string `json:"type,omitempty"` + Title string `json:"title,omitempty"` + Detail string `json:"detail,omitempty"` + Instance string `json:"instance,omitempty"` + Errors []struct { + Title string `json:"title,omitempty"` + Detail string `json:"detail,omitempty"` + } `json:"errors,omitempty"` + Status int `json:"status,omitempty"` +} + // Error type type Error struct { // ID holds error id or service, usually someting like my_service or id