You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current ParseAddrPort error has the following value
errors.New("not an ip:port")
errors.New("no IP")
errors.New("no port")
errors.New("missing ]")
errors.New("invalid port " + strconv.Quote(port) + " parsing " + strconv.Quote(s))
errors.New("invalid ip:port " + strconv.Quote(s) + ", square brackets can only be used with IPv6 addresses")
errors.New("invalid ip:port " + strconv.Quote(s) + ", IPv6 addresses must be surrounded by square brackets")
I would suggest turning these error values into the following
netip.ParseAddrPort(strconv.Quote(s)): not an ip:port
netip.ParseAddrPort(strconv.Quote(s)): no IP
netip.ParseAddrPort(strconv.Quote(s)): no port
netip.ParseAddrPort(strconv.Quote(s)): missing ]
netip.ParseAddrPort(strconv.Quote(s)): invalid port strconv.Quote(port)
netip.ParseAddrPort(strconv.Quote(s)): square brackets can only be used with IPv6 addresses
netip.ParseAddrPort(strconv.Quote(s)): IPv6 addresses must be surrounded by square brackets
A new error type can be created without exposing the
typeparseAddrErrorstruct {
instring// the string given to ParseAddrPortmsgstring// an explanation of the parse failure
}
func (errparseAddrError) Error() string {
q:=strconv.Quotereturn"netip.ParseAddrPort("+q(err.in) +"): "+err.msg
}
The text was updated successfully, but these errors were encountered:
Does the standard library have any errors that look like that? Specifically the netip.ParseAddrPort(s) part?
seankhliao
changed the title
proposal: net/netip: Normalising errors returned by ParseAddrPort
proposal: net/netip: normalising errors returned by ParseAddrPort
Feb 23, 2024
Proposal Details
The current ParseAddrPort error has the following value
I would suggest turning these error values into the following
A new error type can be created without exposing the
The text was updated successfully, but these errors were encountered: