Skip to content

Commit

Permalink
fix vendor pull error message (#940)
Browse files Browse the repository at this point in the history
* fix vendor pull error message

* Added more error handling messages

* fix test case
  • Loading branch information
samtholiya authored Jan 16, 2025
1 parent 5306fd4 commit 6bd89f1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/exec/vendor_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,16 @@ func ReadAndProcessVendorConfigFile(
// Check if it's a directory
fileInfo, err := os.Stat(foundVendorConfigFile)
if err != nil {
return vendorConfig, false, "", err
if os.IsNotExist(err) {
// File does not exist
return vendorConfig, false, "", fmt.Errorf("Vendoring is not configured. To set up vendoring, please see https://atmos.tools/core-concepts/vendor/")
}
if os.IsPermission(err) {
// Permission error
return vendorConfig, false, "", fmt.Errorf("Permission denied when accessing '%s'. Please check the file permissions.", foundVendorConfigFile)
}
// Other errors
return vendorConfig, false, "", fmt.Errorf("An error occurred while accessing the vendoring configuration: %w", err)
}

var configFiles []string
Expand Down
13 changes: 13 additions & 0 deletions tests/test-cases/vendor-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tests:
- name: atmos vendor pull
enabled: true
description: ""
workdir: "../"
command: "atmos"
args:
- "vendor"
- "pull"
expect:
stderr:
- "Vendoring is not configured. To set up vendoring, please see https://atmos.tools/core-concepts/vendor/"
exit_code: 1

0 comments on commit 6bd89f1

Please sign in to comment.