Skip to content

Commit b328ed5

Browse files
committed
update exit code error message
1 parent dab10d1 commit b328ed5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

dsc/tests/dsc.exit_code.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Describe 'exit code tests' {
55
It 'non-zero exit code in manifest has corresponding message' {
66
$result = dsc resource get -r Test/ExitCode --input "{ exitCode: 8 }" 2>&1
7-
$result | Should -Match 'ERROR.*?[Exit code 8].*?Placeholder from manifest for exit code 8'
7+
$result | Should -Match 'ERROR.*?[Exit code 8].*?manifest description: Placeholder from manifest for exit code 8'
88
}
99
It 'non-zero exit code not in manifest has generic message' {
1010
$result = dsc resource get -r Test/ExitCode --input "{ exitCode: 1 }" 2>&1

dsc_lib/src/dscerror.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ pub enum DscError {
2020
#[error("Command: Executable '{0}' [Exit code {1}] {2}")]
2121
CommandExit(String, i32, String),
2222

23+
#[error("Command: Resource '{0}' [Exit code {1}] manifest description: {2}")]
24+
CommandExitFromManifest(String, i32, String),
25+
2326
#[error("CommandOperation: {0} for executable '{1}'")]
2427
CommandOperation(String, String),
2528

dsc_lib/src/dscresources/command_resource.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ pub fn invoke_command(executable: &str, args: Option<Vec<String>>, input: Option
616616
if exit_code != 0 {
617617
if let Some(exit_codes) = exit_codes {
618618
if let Some(error_message) = exit_codes.get(&exit_code) {
619-
return Err(DscError::Command(executable.to_string(), exit_code, error_message.to_string()));
619+
return Err(DscError::CommandExitFromManifest(executable.to_string(), exit_code, error_message.to_string()));
620620
}
621621
}
622622
return Err(DscError::Command(executable.to_string(), exit_code, cleaned_stderr));

0 commit comments

Comments
 (0)