Mercurial > hg > orthanc
changeset 6309:1f07e38a804f
reformat HTTP error details
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Fri, 12 Sep 2025 11:28:12 +0200 |
| parents | 1486ee6d0a70 |
| children | 72f74eba36fb |
| files | OrthancFramework/Sources/HttpServer/HttpServer.cpp |
| diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp Thu Sep 11 18:50:09 2025 +0200 +++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp Fri Sep 12 11:28:12 2025 +0200 @@ -1893,8 +1893,23 @@ } else { + std::string errorMsgDetails; + if (bindAddresses_.empty()) + { + errorMsgDetails = "port " + port; + } + else + { + errorMsgDetails = listeningPorts; + } + + if (errno != 0) // there might be additionnal details about the error in errno + { + errorMsgDetails += ", errno = " + boost::lexical_cast<std::string>(errno) + ", " + strerror(errno); + } + throw OrthancException(ErrorCode_HttpPortInUse, - " (" + listeningPorts + ")"); + " (" + errorMsgDetails + ")"); } } @@ -1906,7 +1921,7 @@ } #endif - CLOG(WARNING, HTTP) << "HTTP server listening on : " << listeningPorts + CLOG(WARNING, HTTP) << "HTTP server listening on" << (bindAddresses_.empty() ? " port: " + port : ": " + listeningPorts) << " (HTTPS encryption is " << (IsSslEnabled() ? "enabled" : "disabled") << ", remote access is "
