Documentation
¶
Overview ¶
Package errors has Fabric Platform base error module.
Index ¶
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,omitempty"`
ReturnValue int `json:"returnValue"`
Context Context `json:"context,omitempty"`
}
FabricError represents a shared error model.
func New ¶
func New(returnValue 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 (*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.