1- using System ;
1+ using System ;
22using System . Collections . Generic ;
33using System . Collections . ObjectModel ;
44using System . Diagnostics . CodeAnalysis ;
@@ -91,8 +91,9 @@ public async Task<bool> ExecuteAsync(string nswagFilePath,
9191 vars [ "OutFile" ] = outFilePath ;
9292 var roVariables = new ReadOnlyDictionary < string , string > ( vars ) ;
9393
94- LogMessage ( "Values of nswag variables" ) ;
95- LogMessage ( string . Join ( Environment . NewLine , vars . Select ( _ => $ "\t [{ _ . Key } ] = { _ . Value } ") ) ) ;
94+ LogMessage ( "Values of nswag variables: {0}{1}" ,
95+ Environment . NewLine ,
96+ string . Join ( Environment . NewLine , vars . Select ( _ => $ "\t [{ _ . Key } ] = { _ . Value } ") ) ) ;
9697
9798 JObject ? baseNswagDocument = LoadBaseNswag ( baseNswagFilePath ) ;
9899 var nswagDocument = _documentFactory . LoadNswagDocument ( nswagFilePath , roVariables , baseNswagDocument ) ;
@@ -110,18 +111,18 @@ public async Task<bool> ExecuteAsync(string nswagFilePath,
110111 return false ;
111112 }
112113
113- var context = await CreateGenerationContext ( nswagDocument , nswagFilePath , roVariables ) ;
114-
115- if ( context is not null )
114+ try
116115 {
117- if ( context . DocumentReader is null )
118- {
119- Log ? . LogWarning ( NotSetInput , nswagFilePath , "Source not set. Skip generation." ) ;
120- return true ;
121- }
116+ var context = await CreateGenerationContext ( nswagDocument , nswagFilePath , roVariables ) ;
122117
123- try
118+ if ( context is not null )
124119 {
120+ if ( context . DocumentReader is null )
121+ {
122+ Log ? . LogWarning ( NotSetInput , nswagFilePath , "Source not set. Skip generation." ) ;
123+ return true ;
124+ }
125+
125126 LogMessage ( $ "Use settings: { generatorSettings . Key } ") ;
126127 var contentGenerator = await contentGeneratorFactory . Invoke ( context ) ;
127128
@@ -137,14 +138,14 @@ public async Task<bool> ExecuteAsync(string nswagFilePath,
137138 {
138139 Log ? . LogError ( WriteFileErr , outFilePath , "Unable write file. Error: {0}" , ex . Message ) ;
139140 }
140- }
141- catch ( InvalidOperationException ex )
142- {
143- Log ? . LogError ( GenerationErr , nswagFilePath , ex . Message ) ;
144- return false ;
145- }
146141
147- return true ;
142+ return true ;
143+ }
144+ }
145+ catch ( InvalidOperationException ex )
146+ {
147+ Log ? . LogError ( GenerationErr , nswagFilePath , ex . Message ) ;
148+ return false ;
148149 }
149150
150151 return false ;
0 commit comments