| 33 | |
| 34 | template <typename SocketWrapper> |
| 35 | void throwOnError(const SocketWrapper& wrapped, bool expectEmpty = true, const std::string& extraMessage = "") { |
| 36 | if (wrapped.errorMessage().empty() != expectEmpty) { |
| 37 | std::cerr << (expectEmpty ? wrapped.errorMessage() : extraMessage) << std::endl; |
| 38 | throw std::runtime_error(expectEmpty ? wrapped.errorMessage() : extraMessage); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | void throwOnWrongMessage(StatsdServer& server, const std::string& expected) { |
| 43 | auto actual = server.receive(); |
no test coverage detected