improve rendering of newOSError.additionalInfo (#18443)

* improve rendering of newOSError.additionalInfo

* fixup
This commit is contained in:
Timothee Cour 2021-07-07 00:43:16 -07:00 • committed by GitHub
commit ffce6de84c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -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