Skip to content

Commit

Permalink
refactor: added exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
OutdatedGuy authored and MarkOSullivan94 committed Apr 10, 2023
1 parent 3aa0fe5 commit 027b9ab
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions bin/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,22 @@ void main(List<String> arguments) {
);
}
} else {
file.createSync(recursive: true);
_generateConfigFile(file);
try {
file.createSync(recursive: true);
_generateConfigFile(file);
} on Exception catch (e) {
print('Error creating file: $e');
}
}
}

void _generateConfigFile(File configFile) {
configFile.writeAsStringSync(_configFileTemplate);
print('Config file generated successfully');
try {
configFile.writeAsStringSync(_configFileTemplate);
print('Config file generated successfully');
} on Exception catch (e) {
print('Error generating config file: $e');
}
}

const _configFileTemplate = '''
Expand Down

0 comments on commit 027b9ab

Please sign in to comment.