Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Unified Diff: pkg/docgen/lib/src/generator.dart

Issue 270993002: Added error handling and a better error message if we fail to write output in docgen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/docgen/lib/src/viewer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/src/generator.dart
diff --git a/pkg/docgen/lib/src/generator.dart b/pkg/docgen/lib/src/generator.dart
index aba05514e1376b6bf71c8a944fd8ac1621624250..0531869abdfdc8159e716ef3f0877acb27e5583a 100644
--- a/pkg/docgen/lib/src/generator.dart
+++ b/pkg/docgen/lib/src/generator.dart
@@ -136,8 +136,15 @@ void _writeToFile(String text, String filename) {
var parentDir = new Directory(path.dirname(filePath));
if (!parentDir.existsSync()) parentDir.createSync(recursive: true);
- new File(filePath)
- .writeAsStringSync(text, mode: FileMode.WRITE);
+ try {
+ new File(filePath)
+ .writeAsStringSync(text, mode: FileMode.WRITE);
+ } on FileSystemException catch (e) {
+ print('Failed to write to the path $filePath. Do you have write '
+ 'permissions to that directory? If not, please specify a different '
+ 'output directory using the --out option.');
+ exit(1);
+ }
}
/// Resolve all the links in the introductory comments for a given library or
« no previous file with comments | « no previous file | pkg/docgen/lib/src/viewer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698