Unverified Commit 76bc4625 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

migrate empty exceptions to tool exit with error message (#79898)

parent 15b9b58e
......@@ -6,6 +6,7 @@
import 'package:meta/meta.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
import '../convert.dart';
......@@ -32,7 +33,7 @@ void generateLocalizations({
logger: logger,
);
if (options.useSyntheticPackage && !flutterManifest.generateSyntheticPackage) {
logger.printError(
throwToolExit(
'Attempted to generate localizations code without having '
'the flutter: generate flag turned on.'
'\n'
......@@ -40,7 +41,6 @@ void generateLocalizations({
'been added and rebuild the project. Otherwise, the localizations '
'source code will not be importable.'
);
throw Exception();
}
precacheLanguageAndRegionTags();
......@@ -71,8 +71,7 @@ void generateLocalizations({
..loadResources()
..writeOutputFiles(logger, isFromYaml: true);
} on L10nException catch (e) {
logger.printError(e.message);
throw Exception();
throwToolExit(e.message);
}
}
......
......@@ -115,11 +115,10 @@ flutter:
projectDir: fileSystem.currentDirectory,
dependenciesDir: fileSystem.currentDirectory,
),
throwsA(isA<Exception>()),
);
expect(
logger.errorText,
contains('Attempted to generate localizations code without having the flutter: generate flag turned on.'),
throwsToolExit(
message: 'Attempted to generate localizations code without having the '
'flutter: generate flag turned on.',
),
);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment