Пример #1
0
 public async Task <DeviceTwinTagsDto> GetDeviceTwinTagsByIdAsync(string id)
 {
     try
     {
         // now invoke the service fabric service.
         return(await _deviceStoreService.GetDeviceTwinTagsByIdAsync(id));
     }
     catch (FabricServiceNotFoundException notFoundex)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
         {
             Content = new StringContent(
                 $"Unable to communicate with the DeviceStoreService to get the Device Twin tags. 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 to get the Device Twin tags. Reason: {ex.Message} "),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
 public async Task <DeviceTwinTagsDto> GetDeviceTwinTagsByIdAsync(string id)
 {
     try
     {
         // now invoke the service fabric service.
         return(await _deviceStoreService.GetDeviceTwinTagsByIdAsync(id));
     }
     catch (FabricServiceNotFoundException notFoundex)
     {
         throw new Exception(
                   $"Unable to communicate with the DeviceStoreService to get the Device Twin tags. Reason: {notFoundex.Message} ");
     }
     catch (Exception ex)
     {
         throw new Exception(
                   $"Unable to communicate with the DeviceStoreService to get the Device Twin tags. Reason: {ex.Message}");
     }
 }