public async Task <Device> GetDeviceByIdAsync(string id) { try { return(await _deviceStoreService.GetDeviceByIdAsync(id)); } catch (FabricServiceNotFoundException notFoundex) { throw new Exception( $"Unable to communicate with the DeviceStoreService to get the Device meta data. Reason: {notFoundex.Message}"); } catch (Exception ex) { throw new Exception($"Unable to communicate with the DeviceStoreService reason: {ex} "); } }
public async Task <Device> GetDeviceByIdAsync(string id) { try { return(await _deviceStoreService.GetDeviceByIdAsync(id)); } catch (FabricServiceNotFoundException notFoundex) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent($"Unable to communicate with the DeviceStoreService to get the Device meta data. Reason: {notFoundex.Message} "), ReasonPhrase = notFoundex.ErrorCode.ToString() }); } catch (Exception ex) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent($"Unable to communicate with the DeviceStoreService reason: {ex} "), ReasonPhrase = "Critical Exception" }); } }