MarshalJSON implements json.Marshaler.
()
| 103 | |
| 104 | // MarshalJSON implements json.Marshaler. |
| 105 | func (e *Error) MarshalJSON() (result []byte, err error) { |
| 106 | var jsonRepresentation struct { |
| 107 | Code uint32 `json:"code,omitempty"` |
| 108 | Error string `json:"message"` |
| 109 | } |
| 110 | jsonRepresentation.Code = uint32(e.code) |
| 111 | jsonRepresentation.Error = e.Error() |
| 112 | return json.Marshal(jsonRepresentation) |
| 113 | } |
| 114 | |
| 115 | // Error implements error. it consults the Printer for the output. |
| 116 | func (e *Error) Error() string { |