Skip to content

Commit

Permalink
chore: Handle error from CleanupTempFiles in deferred func (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-pius authored Sep 27, 2024
1 parent 65ebdbe commit ee70cf9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/service/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ func (s *Service) Run(opts Options) error {
if err := opts.Validate(); err != nil {
return err
}
defer s.moduleConfigService.CleanupTempFiles()

defer func() {
if err := s.moduleConfigService.CleanupTempFiles(); err != nil {
opts.Out.Write(fmt.Sprintf("failed to cleanup temporary files: %v\n", err))
}
}()

moduleConfig, err := s.moduleConfigService.ParseAndValidateModuleConfig(opts.ModuleConfigFile)
if err != nil {
return fmt.Errorf("failed to parse module config: %w", err)
Expand Down

0 comments on commit ee70cf9

Please sign in to comment.