-
Notifications
You must be signed in to change notification settings - Fork 0
/
problem.go
21 lines (16 loc) · 889 Bytes
/
problem.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Package problem provides a simple struct for creating API Problems for your Go Lang API
package problem
// APIProblem defines a structure to return if there is a problem with an API request
// It takes a Title, Detail, Status and Code all as Strings.
type APIProblem struct {
// Title is a short, human readable summary of your problem
Title string `json:"title,omitempty"`
// Detail is a longer human-readable explaination which explains your problem in more detail
Detail string `json:"detail,omitempty"`
// Status is te HTTP status code that is applicable to the problem itself
Status string `json:"status,omitempty"`
// Code is the specific application error code - can be used for internal tracing
Code string `json:"code,omitempty"`
// Meta is an object containing none specific meta-details about the problem
Meta *map[string]interface{} `json:"meta,omitempty"`
}