Skip to content

Commit

Permalink
fix typos and remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwareus committed Dec 12, 2023
1 parent 0911e21 commit 254a8e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions internal/resolution/pm/pip/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,29 +142,24 @@ func (j *Job) handleInstallError(cmdErr job.IError) {
[]string{
"Failed to install python dependency ",
dependencyName,
" due to authorization.\n" + util.InstalLPrivateDependencyMessage,
" due to authorization.\n" + util.InstallPrivateDependencyMessage,
}, ""),
)

case couldNotFindVersionError.MatchString(cmdErr.Error()):
// Define a regex to match the dependency name
dependencyNamePattern := regexp.MustCompile(`Could not find a version that satisfies the requirement ([\w=]+)`)
dependencyNameMatch := dependencyNamePattern.FindStringSubmatch(cmdErr.Error())

dependencyName := ""
if len(dependencyNameMatch) > 1 {
// Split the dependency name and version
dependency := strings.Split(dependencyNameMatch[1], "==")
dependencyName = "\"" + dependency[0] + "\""
}

// Set the documentation string
cmdErr.SetDocumentation(
strings.Join(
[]string{
"Failed to find a version that satisfies the requirement for python dependency ",
dependencyName,
". This could mean that the package or version does not exist.\n" + util.InstalLPrivateDependencyMessage,
". This could mean that the package or version does not exist.\n" + util.InstallPrivateDependencyMessage,
}, ""),
)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/resolution/pm/util/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type PMJobError struct {
status string
}

var InstalLPrivateDependencyMessage = "If this is a private dependency, please make sure that the debricked CLI has access to install it or pre-install it before running the debricked CLI."
var InstallPrivateDependencyMessage = "If this is a private dependency, please make sure that the debricked CLI has access to install it or pre-install it before running the debricked CLI."
var UnknownError = "No specific documentation for this problem yet. If you would like this message to more informative for this error, please create an issue here: https://github.com/debricked/cli/issues"

func (e PMJobError) Error() string {
Expand Down

0 comments on commit 254a8e0

Please sign in to comment.