Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/component/module/git/internal/vcs/errors.go
4096 views
1
package vcs
2
3
import "fmt"
4
5
// DownloadFailedError represents a failure to download a repository.
6
type DownloadFailedError struct {
7
Repository string
8
Inner error
9
}
10
11
// Error returns the error string, denoting the failed repository.
12
func (err DownloadFailedError) Error() string {
13
if err.Inner == nil {
14
return fmt.Sprintf("failed to download repository %q", err.Repository)
15
}
16
return fmt.Sprintf("failed to download repository %q: %s", err.Repository, err.Inner)
17
}
18
19
// Unwrap returns the inner error. It returns nil if there is no inner error.
20
func (err DownloadFailedError) Unwrap() error { return err.Inner }
21
22
// UpdateFailedError represents a failure to update a repository.
23
type UpdateFailedError struct {
24
Repository string
25
Inner error
26
}
27
28
// Error returns the error string, denoting the failed repository.
29
func (err UpdateFailedError) Error() string {
30
if err.Inner == nil {
31
return fmt.Sprintf("failed to update repository %q", err.Repository)
32
}
33
return fmt.Sprintf("failed to update repository %q: %s", err.Repository, err.Inner)
34
}
35
36
// Unwrap returns the inner error. It returns nil if there is no inner error.
37
func (err UpdateFailedError) Unwrap() error { return err.Inner }
38
39
// InvalidRevisionError represents an invalid revision.
40
type InvalidRevisionError struct {
41
Revision string
42
}
43
44
// Error returns the error string, denoting the invalid revision.
45
func (err InvalidRevisionError) Error() string {
46
return fmt.Sprintf("invalid revision %s", err.Revision)
47
}
48
49