improve rendering of newOSError.additionalInfo (#18443)
* improve rendering of newOSError.additionalInfo * fixup
This commit is contained in:
parent
3eb3e6b9a3
commit
ffce6de84c
2 changed files with 6 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue