transport: specialize throw message per transport backend Specialize the error message per transport backend so consumers can quickly identify which transport layer failed to initialize. Without this change, a generic "Cannot initialize transport layer" error is thrown regardless of which transport backend pldmd was built with. Consumers have no way to distinguish whether the issue is a missing mctp-demux service, a missing af-mctp service, or pldmd being built with the wrong transport support. Change-Id: I003785f05c7c492c040fa4df4a46bdf59a087081 Signed-off-by: Vishnunithyasoundhar S <vishnunithyasoundhar.s@intel.com>
diff --git a/common/transport.cpp b/common/transport.cpp index 4c19ced..6b7836a 100644 --- a/common/transport.cpp +++ b/common/transport.cpp
@@ -125,7 +125,14 @@ transport = transport_impl_init(impl, pfd, listening); if (!transport) { - throw std::runtime_error("Cannot initialize transport layer"); +#if defined(PLDM_TRANSPORT_WITH_MCTP_DEMUX) + throw std::runtime_error( + "Cannot initialize mctp-demux transport layer"); +#elif defined(PLDM_TRANSPORT_WITH_AF_MCTP) + throw std::runtime_error("Cannot initialize af-mctp transport layer"); +#else + throw std::runtime_error("Cannot initialize unknown transport layer"); +#endif } }