-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Error): add Google JSON style error response (#4)
implement error response with Google JSON style format
- Loading branch information
1 parent
d694b0a
commit ab83acc
Showing
4 changed files
with
74 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ctx | ||
|
||
type GErrors []GError | ||
|
||
type GError struct { | ||
Code int `json:"-"` | ||
Domain string `json:"domain,omitempty"` | ||
Reason string `json:"reason,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
Location string `json:"location,omitempty"` | ||
LocationType string `json:"locationType,omitempty"` | ||
ExtendedHelp string `json:"extendedHelp,omitempty"` | ||
SendReport string `json:"sendReport,omitempty"` | ||
} | ||
|
||
func (c GErrors) Append(gerr GError) GErrors { | ||
c = append(c, gerr) | ||
return c | ||
} | ||
|
||
func NewGErrors() GErrors { return GErrors{} } |