Parse list of URLs and write any errors to stderr with column information.
import std.stdio : stderr; auto urls = ["irc://example.com", "ircs://example.org/foo?pass"]; foreach(url; urls) { ConnectionInfo info; if(auto error = url.tryParse(info)) { stderr.writefln("Error parsing URL:\n%s\n%*s\n%s", url, error.location + 1, "^", error.message); continue; } // Use `info` }
Same as parse, but returning an error message instead of throwing. Useful for high-volume parsing.