Errors returns an array with all the error messages. Example: c.Error(errors.New("first")) c.Error(errors.New("second")) c.Error(errors.New("third")) c.Errors.Errors() // == []string{"first", "second", "third"}
()
| 128 | // c.Error(errors.New("third")) |
| 129 | // c.Errors.Errors() // == []string{"first", "second", "third"} |
| 130 | func (a errorMsgs) Errors() []string { |
| 131 | if len(a) == 0 { |
| 132 | return nil |
| 133 | } |
| 134 | errorStrings := make([]string, len(a)) |
| 135 | for i, err := range a { |
| 136 | errorStrings[i] = err.Error() |
| 137 | } |
| 138 | return errorStrings |
| 139 | } |
| 140 | |
| 141 | func (a errorMsgs) JSON() any { |
| 142 | switch length := len(a); length { |