diff options
author | Lars Wirzenius <liw@noreply.codeberg.org> | 2023-10-15 06:58:55 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@noreply.codeberg.org> | 2023-10-15 06:58:55 +0000 |
commit | 8db5adbb441516bd81805ae6339ccad512b5670c (patch) | |
tree | faa00a1372d13b9a70bb98fc9942694d71da4417 | |
parent | b75f625d5cd3dd8d3a525e39aaf0d775ced2fb4d (diff) | |
parent | 8ea3b2a70f9295b7e9b6c934b4a7fcc4074b3202 (diff) | |
download | ambient-run-8db5adbb441516bd81805ae6339ccad512b5670c.tar.gz |
Merge pull request 'fix: invalid YAML configuration files are reported as errors' (#25) from liw/parse-error into main
Reviewed-on: https://codeberg.org/ambient/ambient-run/pulls/25
-rw-r--r-- | ambient-run.md | 40 | ||||
-rw-r--r-- | src/bin/ambient-run.rs | 1 | ||||
-rw-r--r-- | src/config.rs | 2 |
3 files changed, 42 insertions, 1 deletions
diff --git a/ambient-run.md b/ambient-run.md index db16dfb..7be3be6 100644 --- a/ambient-run.md +++ b/ambient-run.md @@ -461,6 +461,46 @@ then file extracted/README.md contains "my project!" ~~~ ## Errors during build +### Bad per-user configuration + +_Requirement:_ `ambient-run` fails if the per-user configuration is +bad. + +_Justification:_ As a user I want to get an error if the configuration +is wrong. + +_Stakeholder:_ Lars + +~~~scenario +given an installed ambient-run +given file garbage.yaml +when I try to run ambient-run --config garbage.yaml config +then command fails +then stderr contains "garbage.yaml" +~~~ + +~~~{#garbage.yaml .file .yaml} +This is not a valid YAML file. +~~~ + +### Bad per-project configuration + +_Requirement:_ `ambient-run` fails if the project configuration is +bad. + +_Justification:_ As a user I want to get an error if the configuration +is wrong. + +_Stakeholder:_ Lars + +~~~scenario +given an installed ambient-run +given file garbage.yaml +when I try to run ambient-run project garbage.yaml +then command fails +then stderr contains "garbage.yaml" +~~~ + ### Build produces too large an artifact ### Build produces too large a cache ### Build demands too many CPUs diff --git a/src/bin/ambient-run.rs b/src/bin/ambient-run.rs index 8157de7..6083286 100644 --- a/src/bin/ambient-run.rs +++ b/src/bin/ambient-run.rs @@ -19,6 +19,7 @@ fn main() { eprintln!(" caused by: {}", underlying); e = underlying.source(); } + std::process::exit(1); } } diff --git a/src/config.rs b/src/config.rs index 28e6e96..dfbe040 100644 --- a/src/config.rs +++ b/src/config.rs @@ -33,7 +33,7 @@ impl Config { /// Load named configuration file, update self with values. pub fn add_from(&mut self, filename: &Path) -> Result<(), ConfigError> { - eprintln!("adding from {}", filename.display()); + eprintln!("loading configuration from {}", filename.display()); let bytes = std::fs::read(filename).map_err(|e| ConfigError::Open(filename.into(), e))?; let text = String::from_utf8_lossy(&bytes); eprintln!("text: {:?}", text); |