(msg string, errorOperationResults []remoteOperationResult)
| 202 | } |
| 203 | |
| 204 | func remoteOperationError(msg string, errorOperationResults []remoteOperationResult) error { |
| 205 | // Check if empty |
| 206 | if len(errorOperationResults) == 0 { |
| 207 | return nil |
| 208 | } |
| 209 | |
| 210 | // Check if all identical |
| 211 | var err error |
| 212 | for _, entry := range errorOperationResults { |
| 213 | if err != nil && entry.Error.Error() != err.Error() { |
| 214 | errorStrings := make([]string, 0, len(errorOperationResults)) |
| 215 | for _, operationResult := range errorOperationResults { |
| 216 | errorStrings = append(errorStrings, fmt.Sprintf("%s: %v", operationResult.URL, operationResult.Error)) |
| 217 | } |
| 218 | |
| 219 | return fmt.Errorf("%s:\n - %s", msg, strings.Join(errorStrings, "\n - ")) |
| 220 | } |
| 221 | |
| 222 | err = entry.Error |
| 223 | } |
| 224 | |
| 225 | // Check if successful |
| 226 | if err != nil { |
| 227 | return fmt.Errorf("%s: %w", msg, err) |
| 228 | } |
| 229 | |
| 230 | return nil |
| 231 | } |
| 232 | |
| 233 | // Set the value of a query parameter in the given URI. |
| 234 | func setQueryParam(uri, param, value string) (string, error) { |
no test coverage detected
searching dependent graphs…