cpprestsdk
cpprestsdk copied to clipboard
Different exceptions thrown on linux and windows
When I start http_listener (see code below) with an already bound port, on windows it throws http_exception, but on linux it throws some boost exception. Also if I start two servers with the same URI, std::bad_argument is thrown on linux (http_exception on windows). So there is some platform inconsistency or maybe a difference when using asio vs. windows http server. It should throw in these cases http_exception.
uri_builder uriBuilder(_XPLATSTR("http://localhost"));
uriBuilder.set_port(port);
auto listener = http_listener(uriBuilder.to_uri());
listener.open().get();
IMO the cpprestsdk API should not expose the boost exception. I also agree that different types of exceptions are suboptimal regarding writing platform independet client code.