22// Licensed under the MIT License.
33
44use crate :: args:: OutputFormat ;
5- use crate :: util:: { EXIT_DSC_ERROR , EXIT_INVALID_ARGS , EXIT_JSON_ERROR , add_type_name_to_json, write_output} ;
5+ use crate :: util:: { EXIT_DSC_ERROR , EXIT_INVALID_ARGS , EXIT_JSON_ERROR , EXIT_DSC_RESOURCE_NOT_FOUND , add_type_name_to_json, write_output} ;
66use dsc_lib:: configure:: config_doc:: { Configuration , ExecutionKind } ;
77use dsc_lib:: configure:: add_resource_export_results_to_configuration;
88use dsc_lib:: dscresources:: { resource_manifest:: Kind , invoke_result:: { GetResult , ResourceGetResponse } } ;
@@ -18,7 +18,7 @@ use std::process::exit;
1818pub fn get ( dsc : & DscManager , resource_type : & str , mut input : String , format : & Option < OutputFormat > ) {
1919 let Some ( mut resource) = get_resource ( dsc, resource_type) else {
2020 error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
21- return
21+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
2222 } ;
2323
2424 debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -60,7 +60,7 @@ pub fn get_all(dsc: &DscManager, resource_type: &str, format: &Option<OutputForm
6060 let mut input = String :: new ( ) ;
6161 let Some ( mut resource) = get_resource ( dsc, resource_type) else {
6262 error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
63- return
63+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
6464 } ;
6565
6666 debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -112,7 +112,7 @@ pub fn set(dsc: &DscManager, resource_type: &str, mut input: String, format: &Op
112112
113113 let Some ( mut resource) = get_resource ( dsc, resource_type) else {
114114 error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
115- return
115+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
116116 } ;
117117
118118 debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -158,7 +158,7 @@ pub fn test(dsc: &DscManager, resource_type: &str, mut input: String, format: &O
158158
159159 let Some ( mut resource) = get_resource ( dsc, resource_type) else {
160160 error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
161- return
161+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
162162 } ;
163163
164164 debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -199,7 +199,7 @@ pub fn test(dsc: &DscManager, resource_type: &str, mut input: String, format: &O
199199pub fn delete ( dsc : & DscManager , resource_type : & str , mut input : String ) {
200200 let Some ( mut resource) = get_resource ( dsc, resource_type) else {
201201 error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
202- return
202+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
203203 } ;
204204
205205 debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -230,7 +230,7 @@ pub fn delete(dsc: &DscManager, resource_type: &str, mut input: String) {
230230pub fn schema ( dsc : & DscManager , resource_type : & str , format : & Option < OutputFormat > ) {
231231 let Some ( resource) = get_resource ( dsc, resource_type) else {
232232 error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
233- return
233+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
234234 } ;
235235 if resource. kind == Kind :: Adapter {
236236 error ! ( "Can not perform this operation on the adapter {} itself" , resource. type_name) ;
@@ -260,7 +260,7 @@ pub fn export(dsc: &mut DscManager, resource_type: &str, format: &Option<OutputF
260260 let mut input = String :: new ( ) ;
261261 let Some ( dsc_resource) = get_resource ( dsc, resource_type) else {
262262 error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
263- return
263+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
264264 } ;
265265
266266 if dsc_resource. kind == Kind :: Adapter {
0 commit comments