@@ -47,31 +47,7 @@ pub struct InitArgs {
4747 workspace_folder : Option < PathBuf > ,
4848}
4949
50- #[ allow( clippy:: enum_variant_names) ]
51- #[ derive( thiserror:: Error , Debug ) ]
52- pub enum InitError {
53- #[ error( transparent) ]
54- ParseBoolError ( #[ from] std:: str:: ParseBoolError ) ,
55- #[ error( transparent) ]
56- IOError ( #[ from] std:: io:: Error ) ,
57- #[ error( transparent) ]
58- SystemTimeError ( #[ from] std:: time:: SystemTimeError ) ,
59- #[ error( transparent) ]
60- RegexBuildError ( #[ from] regex:: Error ) ,
61- #[ error( transparent) ]
62- JsonError ( #[ from] serde_json:: error:: Error ) ,
63- #[ error( transparent) ]
64- JsonWithCommentsError ( #[ from] serde_jsonc:: error:: Error ) ,
65- #[ error( transparent) ]
66- PromptError ( #[ from] inquire:: error:: InquireError ) ,
67- #[ error( transparent) ]
68- OciPkgError ( #[ from] ocipkg:: error:: Error ) ,
69- }
70-
71- fn get_feature (
72- index : & registry:: DevcontainerIndex ,
73- feature_ref : & OciReference ,
74- ) -> ocipkg:: error:: Result < registry:: Feature > {
50+ fn get_feature ( index : & registry:: DevcontainerIndex , feature_ref : & OciReference ) -> anyhow:: Result < registry:: Feature > {
7551 log:: debug!( "get_feature" ) ;
7652
7753 match index. get_feature ( & feature_ref. id ( ) ) {
@@ -80,7 +56,7 @@ fn get_feature(
8056 }
8157}
8258
83- fn pull_feature_configuration ( feature_ref : & OciReference ) -> ocipkg :: error :: Result < registry:: Feature > {
59+ fn pull_feature_configuration ( feature_ref : & OciReference ) -> anyhow :: Result < registry:: Feature > {
8460 log:: debug!( "pull_feature_configuration" ) ;
8561 let bytes = registry:: pull_archive_bytes ( feature_ref) ?;
8662 let mut archive = Archive :: new ( bytes. as_slice ( ) ) ;
@@ -186,7 +162,7 @@ impl<'t> DevOptionPrompt<'t> {
186162 }
187163 }
188164
189- fn display_prompt ( & self ) -> Result < DevOptionPromptValue , InitError > {
165+ fn display_prompt ( & self ) -> anyhow :: Result < DevOptionPromptValue > {
190166 let dev_option = self . inner ;
191167 let default = dev_option. configured_default ( ) ;
192168
@@ -296,7 +272,7 @@ impl FeatureEntryBuilder {
296272 }
297273 }
298274
299- fn use_prompt_values ( & mut self , feature : & registry:: Feature ) -> Result < ( ) , InitError > {
275+ fn use_prompt_values ( & mut self , feature : & registry:: Feature ) -> anyhow :: Result < ( ) > {
300276 log:: debug!( "FeatureEntryBuilder::use_prompt_values" ) ;
301277 let key = format ! ( "{}:{}" , feature. id, feature. major_version) ;
302278 let value = {
@@ -355,7 +331,7 @@ struct TemplateBuilder {
355331}
356332
357333impl TemplateBuilder {
358- fn new ( template_ref : & OciReference , config : Option < registry:: Template > ) -> ocipkg :: error :: Result < Self > {
334+ fn new ( template_ref : & OciReference , config : Option < registry:: Template > ) -> anyhow :: Result < Self > {
359335 log:: debug!( "TemplateBuilder::new" ) ;
360336 let archive_bytes = registry:: pull_archive_bytes ( template_ref) ?;
361337 let template_archive = TemplateBuilder {
@@ -400,7 +376,7 @@ impl TemplateBuilder {
400376 ) ) ?
401377 }
402378
403- fn use_prompt_values ( & mut self ) -> Result < ( ) , InitError > {
379+ fn use_prompt_values ( & mut self ) -> anyhow :: Result < ( ) > {
404380 log:: debug!( "TemplateBuilder::use_prompt_values" ) ;
405381 let config = self
406382 . config
@@ -467,7 +443,7 @@ impl TemplateBuilder {
467443 false
468444 }
469445
470- fn apply_context_and_features ( & mut self , attempt_single_file : bool , workspace : & Path ) -> Result < ( ) , InitError > {
446+ fn apply_context_and_features ( & mut self , attempt_single_file : bool , workspace : & Path ) -> anyhow :: Result < ( ) > {
471447 log:: debug!( "TemplateBuilder::apply_context_and_features" ) ;
472448 let template_option_re = Regex :: new ( r"\$\{templateOption:\s*(?<name>\w+)\s*\}" ) ?;
473449 let apply_context = |captures : & Captures | -> & [ u8 ] {
@@ -564,7 +540,7 @@ impl TemplateBuilder {
564540 Ok ( ( ) )
565541 }
566542
567- fn create_empty_start_point ( ) -> Result < Self , InitError > {
543+ fn create_empty_start_point ( ) -> anyhow :: Result < Self > {
568544 let template_value = serde_json:: json!( {
569545 "id" : "tyedev-base-template" ,
570546 "version" : "1.0.0" ,
@@ -712,7 +688,7 @@ pub fn init(
712688 include_deprecated,
713689 workspace_folder,
714690 } : InitArgs ,
715- ) -> Result < ( ) , InitError > {
691+ ) -> anyhow :: Result < ( ) > {
716692 log:: debug!( "init" ) ;
717693 // Do this evaluation of the `env` first so that it can error early.
718694 let workspace = workspace_folder. map_or_else ( env:: current_dir, Ok ) ?;
@@ -835,7 +811,7 @@ pub fn init(
835811// TODO these are more *proof of concept* than actual tests...
836812#[ cfg( test) ]
837813mod tests {
838- use super :: { FeatureEntryBuilder , InitError , TemplateBuilder } ;
814+ use super :: { FeatureEntryBuilder , TemplateBuilder } ;
839815 use serde_json:: { self , Map , Value } ;
840816
841817 #[ test]
@@ -859,7 +835,7 @@ mod tests {
859835 }
860836
861837 #[ test]
862- fn test_create_empty_start_point ( ) -> Result < ( ) , InitError > {
838+ fn test_create_empty_start_point ( ) -> anyhow :: Result < ( ) > {
863839 let _template_builder = TemplateBuilder :: create_empty_start_point ( ) ?;
864840 Ok ( ( ) )
865841 }
0 commit comments