MCPcopy Create free account
hub / github.com/blobcache/blobcache / SetError

Method SetError

src/bcp/message.go:224–242  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

222}
223
224func (m *Message) SetError(err error) {
225 switch err.(type) {
226 case blobcache.ErrInvalidHandle:
227 m.SetCode(MT_ERROR_INVALID_HANDLE)
228 case blobcache.ErrNotFound:
229 m.SetCode(MT_ERROR_NOT_FOUND)
230 case blobcache.ErrNoLink:
231 m.SetCode(MT_ERROR_NO_LINK)
232 case blobcache.ErrTooLarge:
233 m.SetCode(MT_ERROR_TOO_LARGE)
234 case blobcache.ErrPermission:
235 m.SetCode(MT_ERROR_NO_PERMISSION)
236 default:
237 m.SetCode(MT_ERROR_UNKNOWN)
238 m.SetBody([]byte(err.Error()))
239 return
240 }
241 m.SetBody(jsonMarshal(err))
242}
243
244func parseWireError(code MessageCode, x []byte) error {
245 var ret error

Callers 3

TestPermissionWireErrorFunction · 0.95
ServeBCPMethod · 0.80
handleAskFunction · 0.80

Calls 4

SetCodeMethod · 0.95
SetBodyMethod · 0.95
jsonMarshalFunction · 0.70
ErrorMethod · 0.45

Tested by 1

TestPermissionWireErrorFunction · 0.76