2025-06-09 17:37:08 +05:30
|
|
|
package packagemanager
|
|
|
|
|
|
|
|
|
|
import (
|
2025-08-21 18:26:05 +05:30
|
|
|
"github.com/safedep/pmg/usefulerror"
|
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 (
|
2025-08-21 18:26:05 +05:30
|
|
|
ErrPackageNotFound = usefulerror.Useful().
|
2026-01-18 16:00:37 +05:30
|
|
|
WithCode(usefulerror.ErrCodeNotFound).
|
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
|
|
|
|
2025-08-21 18:26:05 +05:30
|
|
|
ErrFailedToFetchPackage = usefulerror.Useful().
|
2026-01-18 16:00:37 +05:30
|
|
|
WithCode(usefulerror.ErrCodeNetwork).
|
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.").
|
2025-08-21 18:26:05 +05:30
|
|
|
Msg("failed to fetch package")
|
|
|
|
|
|
|
|
|
|
ErrFailedToResolveVersion = usefulerror.Useful().
|
2026-01-18 16:00:37 +05:30
|
|
|
WithCode(usefulerror.ErrCodeNetwork).
|
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.").
|
2025-08-21 18:26:05 +05:30
|
|
|
Msg("failed to resolve package version")
|
|
|
|
|
|
|
|
|
|
ErrFailedToResolveDependencies = usefulerror.Useful().
|
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.").
|
2025-08-21 18:26:05 +05:30
|
|
|
Msg("failed to resolve dependencies")
|
|
|
|
|
|
|
|
|
|
ErrFailedToParsePackage = usefulerror.Useful().
|
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.").
|
|
|
|
|
Msg("failed to parse package")
|
|
|
|
|
|
|
|
|
|
ErrAuthorNotFound = usefulerror.Useful().
|
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.").
|
|
|
|
|
Msg("author not found")
|
|
|
|
|
|
|
|
|
|
ErrGitHubRateLimitExceeded = usefulerror.Useful().
|
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.").
|
|
|
|
|
Msg("github api rate limit exceeded")
|
2025-06-09 17:37:08 +05:30
|
|
|
)
|