MCPcopy
hub / github.com/lxc/incus / remoteOperationError

Function remoteOperationError

client/util.go:204–231  ·  view source on GitHub ↗
(msg string, errorOperationResults []remoteOperationResult)

Source from the content-addressed store, hash-verified

202}
203
204func 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.
234func setQueryParam(uri, param, value string) (string, error) {

Callers 8

tryCopyImageMethod · 0.85
CopyImageMethod · 0.85
tryRebuildInstanceMethod · 0.85
tryCreateInstanceMethod · 0.85
tryMigrateInstanceMethod · 0.85

Calls 2

ErrorfMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…