Display protocol name in exceptions raised by getProtoByName() (#19808)

This commit is contained in:
kraptor 2022-07-16 23:44:14 +02:00 • committed by GitHub
commit 8679464e49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -214,7 +214,7 @@ proc getProtoByName*(name: string): int {.since: (1, 3, 5).} =
let protoent = posix.getprotobyname(name.cstring) let protoent = posix.getprotobyname(name.cstring)
if protoent == nil: if protoent == nil:
raise newException(OSError, "protocol not found") raise newException(OSError, "protocol not found: " & name)
result = protoent.p_proto.int result = protoent.p_proto.int