github.com/vmware/transport-go@v1.3.4/service/fabric_error.go (about)

     1  package service
     2  
     3  // FabricError is a RFC7807 standard error properties (https://tools.ietf.org/html/rfc7807)
     4  type FabricError struct {
     5  	Type     string `json:"type,omitempty"`
     6  	Title    string `json:"title"`
     7  	Status   int    `json:"status"`
     8  	Detail   string `json:"detail"`
     9  	Instance string `json:"instance,omitempty"`
    10  }
    11  
    12  // GetFabricError will return a structured, standardized Error object that is compliant
    13  // with RFC7807 standard error properties (https://tools.ietf.org/html/rfc7807)
    14  func GetFabricError(message string, code int, detail string) FabricError {
    15  	return FabricError{
    16  		Title:  message,
    17  		Status: code,
    18  		Detail: detail,
    19  		Type:   "https://github.com/vmware/transport-go/blob/main/plank/services/fabric_error.md",
    20  	}
    21  }