Skip to content

Commit

Permalink
Merge pull request #213 from wttech/201-report-lack-of-disk-space-mor…
Browse files Browse the repository at this point in the history
…e-nicely

#201 Report lack of disk space more nicely
  • Loading branch information
krystian-panek-vmltech authored Nov 23, 2023
2 parents f2580fa + 60f760e commit 4db746f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/package_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func (pm *PackageManager) uploadOptimized(localPath string) (string, error) {
return "", fmt.Errorf("%s > cannot upload package '%s'; cannot parse response: %w", pm.instance.ID(), localPath, err)
}
if !status.Success {
return "", fmt.Errorf("%s > cannot upload package '%s'; unexpected status: %s", pm.instance.ID(), localPath, status.Message)
return "", fmt.Errorf("%s > cannot upload package '%s'; %s", pm.instance.ID(), localPath, pm.interpretFail(status.Message))
}
log.Infof("%s > uploaded package '%s'", pm.instance.ID(), localPath)
return status.Path, nil
Expand All @@ -423,12 +423,22 @@ func (pm *PackageManager) uploadBuffered(localPath string) (string, error) {
return "", fmt.Errorf("%s > cannot upload package '%s'; cannot parse response: %w", pm.instance.ID(), localPath, err)
}
if !status.Success {
return "", fmt.Errorf("%s > cannot upload package '%s'; unexpected status: %s", pm.instance.ID(), localPath, status.Message)
return "", fmt.Errorf("%s > cannot upload package '%s'; %s", pm.instance.ID(), localPath, pm.interpretFail(status.Message))
}
log.Infof("%s > uploaded package '%s'", pm.instance.ID(), localPath)
return status.Path, nil
}

func (pm *PackageManager) interpretFail(message string) string {
if strings.Contains(strings.ToLower(message), "inaccessible value") {
return fmt.Sprintf("probably no disk space left (server respond with '%s')", message) // https://forums.adobe.com/thread/2338290
}
if strings.Contains(strings.ToLower(message), "package file parameter missing") {
return fmt.Sprintf("probably no disk space left (server respond with '%s')", message)
}
return fmt.Sprintf("unexpected status: %s", message)
}

func (pm *PackageManager) Install(remotePath string) error {
if pm.InstallHTMLEnabled {
return pm.installHTML(remotePath)
Expand Down

0 comments on commit 4db746f

Please sign in to comment.