-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When the image pull fails, the DataVolume Running condition, will have the Reason field of `ImagePullFailed`, to allow better error handling in code taht uses it. Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
- Loading branch information
Showing
17 changed files
with
196 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package importer | ||
|
||
import ( | ||
"fmt" | ||
|
||
"kubevirt.io/containerized-data-importer/pkg/common" | ||
) | ||
|
||
// ValidationSizeError is an error indication size validation failure. | ||
type ValidationSizeError struct { | ||
err error | ||
} | ||
|
||
func (e ValidationSizeError) Error() string { return e.err.Error() } | ||
|
||
// ErrRequiresScratchSpace indicates that we require scratch space. | ||
var ErrRequiresScratchSpace = fmt.Errorf(common.ScratchSpaceRequired) | ||
|
||
// ErrInvalidPath indicates that the path is invalid. | ||
var ErrInvalidPath = fmt.Errorf("invalid transfer path") | ||
|
||
// ErrImagePullFailed indicates that the importer failed to pull an image; This error type wraps the actual error. | ||
type ErrImagePullFailed struct { | ||
err error | ||
} | ||
|
||
// NewErrImagePullFailed creates new ErrImagePullFailed error object, with embedded error. | ||
// | ||
// Use the err parameter fot the actual wrapped error | ||
func NewErrImagePullFailed(err error) *ErrImagePullFailed { | ||
return &ErrImagePullFailed{ | ||
err: err, | ||
} | ||
} | ||
|
||
func (err *ErrImagePullFailed) Error() string { | ||
return fmt.Sprintf("%s: %s", common.ImagePullFailureText, err.err.Error()) | ||
} | ||
|
||
func (err *ErrImagePullFailed) Unwrap() error { | ||
return err.err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.