Skip to content

Commit

Permalink
pr stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
renancaraujo committed Oct 30, 2023
1 parent e142dae commit 1764b5b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
11 changes: 5 additions & 6 deletions packages/dart_frog_cli/lib/src/commands/dev/dev.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,13 @@ class DevCommand extends DartFrogCommand {

final hostname = results['hostname'] as String?;

late final io.InternetAddress? ip;
if (hostname == null) {
ip = null;
} else {
io.InternetAddress? ip;
if (hostname != null) {
ip = io.InternetAddress.tryParse(hostname);
if (ip == null) {
logger.err('Invalid hostname "$hostname": must be a valid '
'IPv4 or IPv6 address.');
logger.err(
'Invalid hostname "$hostname": must be a valid IPv4 or IPv6 address.',
);
return ExitCode.software.code;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,12 @@ class DevServerDomain extends DomainBase {

final devServerBundleGenerator = await _generator(dartFrogDevServerBundle);

late final InternetAddress? ip;
if (hostname == null) {
ip = null;
} else {
InternetAddress? ip;
if (hostname != null) {
ip = InternetAddress.tryParse(hostname);
if (ip == null) {
throw DartFrogDaemonMalformedMessageException(
'invalid hostname "$hostname": must be a valid '
'IPv4 or IPv6 address.',
'invalid hostname "$hostname": must be a valid IPv4 or IPv6 address.',
);
}
}
Expand Down
6 changes: 6 additions & 0 deletions packages/dart_frog_cli/test/src/commands/dev/dev_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ void main() {

await expectLater(command.run(), completion(ExitCode.software.code));

verify(
() => logger.err(
'Invalid hostname "ticarica": must be a valid IPv4 or IPv6 address.',
),
).called(1);

verifyNever(() => runner.start());
});

Expand Down

0 comments on commit 1764b5b

Please sign in to comment.