diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-08-21 21:15:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-21 21:15:52 +0200 |
commit | 301f6c46ba4491e9aec76037ae9d01365693b0e4 (patch) | |
tree | 94bc33b4fac9adc483a123dfb874be19d5842fbf /ext/flash | |
parent | 5ea51702bd4a3f7b14cd754b3218e50f9ed07bcc (diff) |
fix(unstable): better error for invalid hostname in Deno.serve() (#15529)
Diffstat (limited to 'ext/flash')
-rw-r--r-- | ext/flash/lib.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/flash/lib.rs b/ext/flash/lib.rs index de0a2231c..5d6275155 100644 --- a/ext/flash/lib.rs +++ b/ext/flash/lib.rs @@ -1244,7 +1244,11 @@ where state .borrow_mut::<P>() .check_net(&(&opts.hostname, Some(opts.port)))?; - let addr = SocketAddr::new(opts.hostname.parse()?, opts.port); + let parsed_hostname = opts + .hostname + .parse() + .map_err(|_| type_error("hostname could not be parsed as an IP address"))?; + let addr = SocketAddr::new(parsed_hostname, opts.port); let (tx, rx) = mpsc::channel(100); let (close_tx, close_rx) = mpsc::channel(1); let (listening_tx, listening_rx) = mpsc::channel(1); |