Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package runtime

import "fmt"

type HttpStatusCode uint

// Taken from net/http
Expand Down Expand Up @@ -83,6 +85,13 @@ type Rfc7807Error struct {
Extensions map[string]string `json:"extensions"`
}

// Error implements the error interface for Rfc7807Error.
func (e *Rfc7807Error) Error() string {
// Format all RFC-7807 fields into error string
return fmt.Sprintf("error: type=%s, title=%s, detail=%s, status=%d, instance=%s, extensions=%v",
e.Type, e.Title, e.Detail, e.Status, e.Instance, e.Extensions)
}

// GleeceController provides common functionality for controllers.
type GleeceController struct {
statusCode *HttpStatusCode
Expand Down