InetEndpoint: return proper parser exception

Wrapping this in something foreign doesn't make sense.

Reported-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-19 13:03:08 -06:00
parent 0899b49bb3
commit 240e049e46

View File

@ -51,7 +51,7 @@ public final class InetEndpoint {
try { try {
uri = new URI("wg://" + endpoint); uri = new URI("wg://" + endpoint);
} catch (final URISyntaxException e) { } catch (final URISyntaxException e) {
throw new IllegalArgumentException(e); throw new ParseException(InetEndpoint.class, endpoint, e);
} }
if (uri.getPort() < 0 || uri.getPort() > 65535) if (uri.getPort() < 0 || uri.getPort() > 65535)
throw new ParseException(InetEndpoint.class, endpoint, "Missing/invalid port number"); throw new ParseException(InetEndpoint.class, endpoint, "Missing/invalid port number");