MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / MarshalJSON

Method MarshalJSON

pkg/error/error.go:133–158  ·  view source on GitHub ↗

MarshalJSON xxx

()

Source from the content-addressed store, hash-verified

131
132// MarshalJSON xxx
133func (f FinalError) MarshalJSON() ([]byte, error) {
134 s := ``
135 // basic error
136 x, err := json.Marshal(f.BasicError)
137 if err != nil {
138 return nil, err
139 }
140 s += string(x[0 : len(x)-1])
141 // backtrace
142 if f.Backtrace != nil {
143 s += `,"Backtrace":[`
144 for i, e := range f.Backtrace {
145 x, err = json.Marshal(e)
146 if err != nil {
147 return nil, err
148 }
149 s += string(x)
150 if i < len(f.Backtrace)-1 {
151 s += `,`
152 }
153 }
154 s += `]`
155 }
156 s += `}`
157 return []byte(s), nil
158}
159
160func (err FinalError) toJSON() []byte {
161 b, e := json.Marshal(err)

Callers

nothing calls this directly

Calls 1

MarshalFunction · 0.92

Tested by

no test coverage detected