errors

package
v0.15.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 4 Imported by: 0

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 Context added in v0.9.6

type Context map[string]string

Context is a key/value map to carrier any additional information.

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) Error

func (e *FabricError) Error() string

Error interface implementation.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL