Skip to content

Commit c7b8baf

Browse files
authored
fix(compute): clarify fastly.toml error message when file not found (#1556)
Add "file not found" to the `ErrReadingManifest` error message to make it clearer that the file doesn't exist, rather than a parsing or permission error. ### Change summary The current error message "error reading fastly.toml" is somewhat ambiguous and doesn't clearly indicate whether the file is missing or has parsing errors. The remediation text was present but it still seems easy to misinterpret the actual problem (as proven by it managing to throw both me, Claude and ChatGPT off 😅). This change adds ": file not found" to the error message to make it even more apparent that the file doesn't exist. **Before:** ERROR: error reading fastly.toml. Ensure the Fastly CLI is being run within a directory containing a fastly.toml file... **After:** ERROR: error reading fastly.toml: file not found. Ensure the Fastly CLI is being run within a directory containing a fastly.toml file... All Submissions: * [x] Have you followed the guidelines in our Contributing document? * [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/fastly/cli/pulls) for the same update/change? ### Changes to Core Features: * [x] Have you written new tests for your core changes, as applicable? * [ ] Have you successfully run tests with your changes locally? ### User Impact * Users will now more easily understand that the `fastly.toml` file is missing.
1 parent 21873c6 commit c7b8baf

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- build(dockerfile-rust): add wasm tools to the rust docker container ([#1552](https://github.com/fastly/cli/pull/1552))
99

1010
### Bug fixes:
11+
- fix(compute): clarify fastly.toml error message when file not found ([#1556](https://github.com/fastly/cli/pull/1556))
1112

1213
### Dependencies:
1314
- build(deps): `github.com/hashicorp/cap` from 0.10.0 to 0.11.0 ([#1546](https://github.com/fastly/cli/pull/1546))

pkg/commands/compute/build_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestBuildRust(t *testing.T) {
4040
{
4141
name: "no fastly.toml manifest",
4242
args: args("compute build"),
43-
wantError: "error reading fastly.toml",
43+
wantError: "error reading fastly.toml: file not found",
4444
wantRemediationError: "Run `fastly compute init` to ensure a correctly configured manifest.",
4545
},
4646
{
@@ -300,7 +300,7 @@ func TestBuildGo(t *testing.T) {
300300
{
301301
name: "no fastly.toml manifest",
302302
args: args("compute build"),
303-
wantError: "error reading fastly.toml",
303+
wantError: "error reading fastly.toml: file not found",
304304
wantRemediationError: "Run `fastly compute init` to ensure a correctly configured manifest.",
305305
},
306306
{
@@ -494,7 +494,7 @@ func TestBuildJavaScript(t *testing.T) {
494494
{
495495
name: "no fastly.toml manifest",
496496
args: args("compute build"),
497-
wantError: "error reading fastly.toml",
497+
wantError: "error reading fastly.toml: file not found",
498498
wantRemediationError: "Run `fastly compute init` to ensure a correctly configured manifest.",
499499
},
500500
{

pkg/commands/compute/deploy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func TestDeploy(t *testing.T) {
112112
{
113113
name: "no fastly.toml manifest",
114114
args: args("compute deploy --token 123"),
115-
wantError: "error reading fastly.toml",
115+
wantError: "error reading fastly.toml: file not found",
116116
wantRemediationError: errors.ComputeInitRemediation,
117117
noManifest: true,
118118
},

pkg/errors/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var ErrNoID = RemediationError{
7575

7676
// ErrReadingManifest means there was a problem reading the fastly.toml.
7777
var ErrReadingManifest = RemediationError{
78-
Inner: fmt.Errorf("error reading fastly.toml"),
78+
Inner: fmt.Errorf("error reading fastly.toml: file not found"),
7979
Remediation: "Ensure the Fastly CLI is being run within a directory containing a fastly.toml file. " + ComputeInitRemediation,
8080
}
8181

0 commit comments

Comments
 (0)