()
| 139 | } |
| 140 | |
| 141 | func (a errorMsgs) JSON() any { |
| 142 | switch length := len(a); length { |
| 143 | case 0: |
| 144 | return nil |
| 145 | case 1: |
| 146 | return a.Last().JSON() |
| 147 | default: |
| 148 | jsonData := make([]any, length) |
| 149 | for i, err := range a { |
| 150 | jsonData[i] = err.JSON() |
| 151 | } |
| 152 | return jsonData |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | // MarshalJSON implements the json.Marshaller interface. |
| 157 | func (a errorMsgs) MarshalJSON() ([]byte, error) { |