mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
improve rendering of newOSError.additionalInfo (#18443)
* improve rendering of newOSError.additionalInfo * fixup
This commit is contained in:
@@ -80,8 +80,9 @@ proc newOSError*(
|
||||
e.msg = osErrorMsg(errorCode)
|
||||
if additionalInfo.len > 0:
|
||||
if e.msg.len > 0 and e.msg[^1] != '\n': e.msg.add '\n'
|
||||
e.msg.add "Additional info: "
|
||||
e.msg.addQuoted additionalInfo
|
||||
e.msg.add "Additional info: "
|
||||
e.msg.add additionalInfo
|
||||
# don't add trailing `.` etc, which negatively impacts "jump to file" in IDEs.
|
||||
if e.msg == "":
|
||||
e.msg = "unknown OS error"
|
||||
return e
|
||||
|
||||
@@ -958,7 +958,9 @@ proc bindAddr*(socket: Socket, port = Port(0), address = "") {.
|
||||
var aiList = getAddrInfo(realaddr, port, socket.domain)
|
||||
if bindAddr(socket.fd, aiList.ai_addr, aiList.ai_addrlen.SockLen) < 0'i32:
|
||||
freeaddrinfo(aiList)
|
||||
raiseOSError(osLastError(), "address: $# port: $#" % [address, $port])
|
||||
var address2: string
|
||||
address2.addQuoted address
|
||||
raiseOSError(osLastError(), "address: $# port: $#" % [address2, $port])
|
||||
freeaddrinfo(aiList)
|
||||
|
||||
proc acceptAddr*(server: Socket, client: var owned(Socket), address: var string,
|
||||
|
||||
Reference in New Issue
Block a user