public void RegisterClient([FromBody] Client client) { try { ListClients.addClient(client); } catch (Exception)//Catching all exceptions here as I don't know the specifics { HttpResponseMessage resMessage = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest) { Content = new StringContent($"Failed to add the client with the port {client.port}") }; logger.LogFunc($"Failed to add the client with the port {client.port}"); throw new HttpResponseException(resMessage); } }
public void RegisterClient([FromBody] Client client) { try { ListClients.addClient(client); } catch (Exception) { HttpResponseMessage resMessage = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest) { Content = new StringContent($"Failed add the client with the port num {client.port}") }; logger.LogFunc($"ERROR: Failed to remove the client with the port {client.port}"); throw new HttpResponseException(resMessage); } }