| skipped 215 lines |
216 | 216 | | // We need to determine the image source again, such that this determination |
217 | 217 | | // doesn't take scheme parsing into account. |
218 | 218 | | in.ImageSource = image.DetermineDefaultImagePullSource(in.UserInput) |
219 | | - | img, err = stereoscope.GetImageFromSource(ctx, in.UserInput, in.ImageSource, opts...) |
| 219 | + | img, userInputErr := stereoscope.GetImageFromSource(ctx, in.UserInput, in.ImageSource, opts...) |
220 | 220 | | cleanup = func() { |
221 | 221 | | if err := img.Cleanup(); err != nil { |
222 | 222 | | log.Warnf("unable to cleanup image=%q: %w", in.UserInput, err) |
223 | 223 | | } |
224 | 224 | | } |
225 | | - | return img, cleanup, err |
| 225 | + | if userInputErr != nil { |
| 226 | + | // Image retrieval failed on both tries, we will want to return both errors. |
| 227 | + | return nil, nil, fmt.Errorf( |
| 228 | + | "scheme %q specified; "+ |
| 229 | + | "image retrieval using scheme parsing (%s) was unsuccessful: %v; "+ |
| 230 | + | "image retrieval without scheme parsing (%s) was unsuccessful: %v", |
| 231 | + | scheme, |
| 232 | + | in.Location, |
| 233 | + | err, |
| 234 | + | in.UserInput, |
| 235 | + | userInputErr, |
| 236 | + | ) |
| 237 | + | } |
| 238 | + | |
| 239 | + | return img, cleanup, nil |
226 | 240 | | } |
227 | 241 | | |
228 | 242 | | func generateDirectorySource(fs afero.Fs, in Input) (*Source, func(), error) { |
| skipped 357 lines |