Documentation ¶
Overview ¶
Package errors has Fabric Platform base error module.
Index ¶
- type Context
- type FabricError
- func BadRequestError(description string) FabricError
- func DecodeError(description string) FabricError
- func InternalError(description string) FabricError
- func New(returnValue, httpCode int, name, description string) FabricError
- func NewFromJSON(text string) *FabricError
- func NewFromPod(pod corev1.Pod, containerName string) *FabricError
- func NotFoundError(description string) FabricError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FabricError ¶
type FabricError struct { Name string `json:"name"` Description string `json:"description"` HTTPCode int `json:"httpCode"` ReturnValue int `json:"returnValue"` Context Context `json:"context,omitempty"` }
FabricError represents a shared error model.
func BadRequestError ¶ added in v0.12.0
func BadRequestError(description string) FabricError
BadRequestError represents a model for a bad request with a custom description
func DecodeError ¶ added in v0.12.0
func DecodeError(description string) FabricError
DecodeError represents a model decoding error
func InternalError ¶ added in v0.9.10
func InternalError(description string) FabricError
InternalServerError represents a 500 FabricError that happened in the system
func New ¶
func New(returnValue, httpCode int, name, description string) FabricError
New Creates a new BaseError with the required fields.
func NewFromJSON ¶
func NewFromJSON(text string) *FabricError
NewFromJSON creates a Frabric error based on JSON string error representation.
func NewFromPod ¶ added in v0.9.6
func NewFromPod(pod corev1.Pod, containerName string) *FabricError
NewFromPod creates a FabricError based on LastTerminationState of ContainerStatus given a container Name.
This method is able to decode ContainerStatus.LastTerminationState.Terminated.Message as a JSON payload with the following structure:
{ "name":"UnknownErrorDuringTraining", "description":"Some unknown and specific error during Synth training either training", "httpCode":500, "returnValue":-1, "context":{ "key1":"value1", "key2":"value2" } }
Returns a FabricError or nil if the container is not found.
func NotFoundError ¶ added in v0.9.10
func NotFoundError(description string) FabricError
NotFoundError represents a 404 error with a custom description
func (*FabricError) String ¶
func (e *FabricError) String() string
String returns an string representation of BaseError.
func (*FabricError) ToJSON ¶
func (e *FabricError) ToJSON() (string, error)
ToJSON encode FabircError to JSON string.