MCPcopy Create free account
hub / github.com/cloudfoundry/garden / UnmarshalJSON

Method UnmarshalJSON

errors.go:77–100  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

75}
76
77func (m *Error) UnmarshalJSON(data []byte) error {
78 var result marshalledError
79
80 if err := json.Unmarshal(data, &result); err != nil {
81 return err
82 }
83
84 switch result.Type {
85 case unrecoverableErrType:
86 m.Err = UnrecoverableError{result.Message}
87 case serviceUnavailableErrType:
88 m.Err = ServiceUnavailableError{result.Message}
89 case containerNotFoundErrType:
90 m.Err = ContainerNotFoundError{result.Handle}
91 case processNotFoundErrType:
92 m.Err = ProcessNotFoundError{ProcessID: result.ProcessID}
93 case executableNotFoundError:
94 m.Err = ExecutableNotFoundError{Message: result.Message}
95 default:
96 m.Err = errors.New(result.Message)
97 }
98
99 return nil
100}
101
102func NewUnrecoverableError(symptom string) error {
103 return UnrecoverableError{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected