Skip to content

Commit 66455cc

Browse files
committed
added error log
1 parent e0aeb72 commit 66455cc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

openapi-generator/lib/src/openapi_generator_runner.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,14 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
132132
break;
133133
case annots.Generator.DART_DIO:
134134
case annots.Generator.DART_JAGUAR:
135-
var runnerOutput = await runSourceGen(outputDirectory);
136-
print(
137-
'OpenapiGenerator :: build runner exited with code ${runnerOutput.exitCode} ::');
135+
try {
136+
var runnerOutput = await runSourceGen(outputDirectory);
137+
print(
138+
'OpenapiGenerator :: build runner exited with code ${runnerOutput.exitCode} ::');
139+
} catch (e) {
140+
print(e);
141+
print('OpenapiGenerator :: could not complete source gen ::');
142+
}
138143
break;
139144
}
140145
}
@@ -146,9 +151,10 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
146151
}
147152

148153
Future<ProcessResult> runSourceGen(String outputDirectory) async {
149-
print('OpenapiGenerator :: running source code generations ::');
154+
print('OpenapiGenerator :: running source code generation ::');
150155
var c = 'pub run build_runner build --delete-conflicting-outputs';
151-
var runnerOutput = await Process.run('flutter', c.split(' ').toList(),
156+
ProcessResult runnerOutput;
157+
runnerOutput = await Process.run('flutter', c.split(' ').toList(),
152158
runInShell: Platform.isWindows, workingDirectory: '$outputDirectory');
153159
print(runnerOutput.stderr);
154160
return runnerOutput;

0 commit comments

Comments
 (0)