Skip to content

Commit

Permalink
Merge pull request #16 from jacobaraujo7/fix_map2
Browse files Browse the repository at this point in the history
Fix map and throws binary errors
  • Loading branch information
Seven Du authored Sep 8, 2022
2 parents 9694714 + 5e5c894 commit 8c3ab9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions bin/src/commands/generate_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class GenerateCommand extends Command {
},
);

// throw error
if (configProcessResult.exitCode > 0) {
final json = jsonDecode(configProcessResult.stderr);
throw json['message'];
}

// Parse config result.
final GetConfigResult configResult = GetConfigResult.fromJson(
jsonDecode(configProcessResult.stdout as String) as Map<String, dynamic>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ String _constructorBuilder(dmmf.InputType input) {
if (field.isRequired) code.write('required ');
code.writeln('this.${_fieldName(field.name)},');
}

if (input.fields.isNotEmpty) {
code.writeln('}');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/configure/configure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class Configure {
: defaultValue;

/// Environments.
Map<String, String> get environment => call('environment');
Map<String, String> get environment => call('environment') ?? {};

/// Get environment variable.
String? env(String name) => environment[name];
Expand Down

0 comments on commit 8c3ab9e

Please sign in to comment.