Path: blob/main/component/module/git/internal/vcs/errors.go
4096 views
package vcs12import "fmt"34// DownloadFailedError represents a failure to download a repository.5type DownloadFailedError struct {6Repository string7Inner error8}910// Error returns the error string, denoting the failed repository.11func (err DownloadFailedError) Error() string {12if err.Inner == nil {13return fmt.Sprintf("failed to download repository %q", err.Repository)14}15return fmt.Sprintf("failed to download repository %q: %s", err.Repository, err.Inner)16}1718// Unwrap returns the inner error. It returns nil if there is no inner error.19func (err DownloadFailedError) Unwrap() error { return err.Inner }2021// UpdateFailedError represents a failure to update a repository.22type UpdateFailedError struct {23Repository string24Inner error25}2627// Error returns the error string, denoting the failed repository.28func (err UpdateFailedError) Error() string {29if err.Inner == nil {30return fmt.Sprintf("failed to update repository %q", err.Repository)31}32return fmt.Sprintf("failed to update repository %q: %s", err.Repository, err.Inner)33}3435// Unwrap returns the inner error. It returns nil if there is no inner error.36func (err UpdateFailedError) Unwrap() error { return err.Inner }3738// InvalidRevisionError represents an invalid revision.39type InvalidRevisionError struct {40Revision string41}4243// Error returns the error string, denoting the invalid revision.44func (err InvalidRevisionError) Error() string {45return fmt.Sprintf("invalid revision %s", err.Revision)46}474849