2025-06-09 17:37:08 +05:30
|
|
|
package packagemanager
|
|
|
|
|
|
|
|
|
|
import (
|
2026-05-24 12:22:19 +05:30
|
|
|
"github.com/safedep/dry/usefulerror"
|
|
|
|
|
"github.com/safedep/pmg/errcodes"
|
2025-06-09 17:37:08 +05:30
|
|
|
)
|
|
|
|
|
|
2026-01-18 16:00:37 +05:30
|
|
|
const (
|
|
|
|
|
errDependencyResolutionFailed = "DependencyResolutionFailed"
|
|
|
|
|
errPackageParseFailed = "PackageParseFailed"
|
|
|
|
|
errPackageAuthorNotFound = "PackageAuthorNotFound"
|
|
|
|
|
errGitHubRateLimitExceeded = "GitHubRateLimitExceeded"
|
|
|
|
|
)
|
|
|
|
|
|
2025-06-09 17:37:08 +05:30
|
|
|
var (
|
2026-05-24 12:22:19 +05:30
|
|
|
ErrPackageNotFound = usefulerror.NewUsefulError().
|
|
|
|
|
WithCode(errcodes.NotFound).
|
2025-08-21 18:26:05 +05:30
|
|
|
WithHumanError("The requested package could not be found.").
|
|
|
|
|
WithHelp("Please check the package name and try again.")
|
2025-06-09 17:37:08 +05:30
|
|
|
|
2026-05-24 12:22:19 +05:30
|
|
|
ErrFailedToFetchPackage = usefulerror.NewUsefulError().
|
|
|
|
|
WithCode(errcodes.Network).
|
2025-08-21 18:26:05 +05:30
|
|
|
WithHumanError("Failed to retrieve the requested package.").
|
2026-01-18 16:00:37 +05:30
|
|
|
WithHelp("Check your network connection and try again.").
|
2026-05-24 12:22:19 +05:30
|
|
|
WithMsg("failed to fetch package")
|
2025-08-21 18:26:05 +05:30
|
|
|
|
2026-05-24 12:22:19 +05:30
|
|
|
ErrFailedToResolveVersion = usefulerror.NewUsefulError().
|
|
|
|
|
WithCode(errcodes.Network).
|
2025-08-21 18:26:05 +05:30
|
|
|
WithHumanError("Failed to resolve the requested package version.").
|
2026-01-18 16:00:37 +05:30
|
|
|
WithHelp("Check your network connection and try again.").
|
2026-05-24 12:22:19 +05:30
|
|
|
WithMsg("failed to resolve package version")
|
2025-08-21 18:26:05 +05:30
|
|
|
|
2026-05-24 12:22:19 +05:30
|
|
|
ErrFailedToResolveDependencies = usefulerror.NewUsefulError().
|
2026-01-18 16:00:37 +05:30
|
|
|
WithCode(errDependencyResolutionFailed).
|
2025-08-21 18:26:05 +05:30
|
|
|
WithHumanError("Failed to resolve dependencies.").
|
2026-01-18 16:00:37 +05:30
|
|
|
WithHelp("Check your network connection and try again.").
|
2026-05-24 12:22:19 +05:30
|
|
|
WithMsg("failed to resolve dependencies")
|
2025-08-21 18:26:05 +05:30
|
|
|
|
2026-05-24 12:22:19 +05:30
|
|
|
ErrFailedToParsePackage = usefulerror.NewUsefulError().
|
2026-01-18 16:00:37 +05:30
|
|
|
WithCode(errPackageParseFailed).
|
2025-08-21 18:26:05 +05:30
|
|
|
WithHumanError("The package data could not be processed.").
|
|
|
|
|
WithHelp("The package may be corrupted or in an unsupported format.").
|
2026-05-24 12:22:19 +05:30
|
|
|
WithMsg("failed to parse package")
|
2025-08-21 18:26:05 +05:30
|
|
|
|
2026-05-24 12:22:19 +05:30
|
|
|
ErrAuthorNotFound = usefulerror.NewUsefulError().
|
2026-01-18 16:00:37 +05:30
|
|
|
WithCode(errPackageAuthorNotFound).
|
2025-08-21 18:26:05 +05:30
|
|
|
WithHumanError("The package author information could not be found.").
|
|
|
|
|
WithHelp("This may be due to incomplete package metadata or network issues.").
|
2026-05-24 12:22:19 +05:30
|
|
|
WithMsg("author not found")
|
2025-08-21 18:26:05 +05:30
|
|
|
|
2026-05-24 12:22:19 +05:30
|
|
|
ErrGitHubRateLimitExceeded = usefulerror.NewUsefulError().
|
2026-01-18 16:00:37 +05:30
|
|
|
WithCode(errGitHubRateLimitExceeded).
|
2025-08-21 18:26:05 +05:30
|
|
|
WithHumanError("GitHub API rate limit has been exceeded.").
|
|
|
|
|
WithHelp("Wait for the rate limit to reset or configure authentication to increase your rate limit.").
|
2026-05-24 12:22:19 +05:30
|
|
|
WithMsg("github api rate limit exceeded")
|
2025-06-09 17:37:08 +05:30
|
|
|
)
|