コード例 #1
0
 public async Task RemoveFile(string branchName, string path)
 {
     try
     {
         await _assetsStorage.DeleteFile(branchName, path);
     }
     catch (BranchException ex)
     {
         var resp = new HttpResponseMessage(System.Net.HttpStatusCode.NotFound)
         {
             Content      = new StringContent(ex.Message),
             ReasonPhrase = $"{branchName} not found !"
         };
         throw new HttpResponseException(resp);
     }
     catch (FileException ex)
     {
         var resp = new HttpResponseMessage(System.Net.HttpStatusCode.NotFound)
         {
             Content      = new StringContent(ex.Message),
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(resp);
     }
     catch (ElasticsearchException)
     {
         var resp = new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent($"Internal data base error please check server logs"),
             ReasonPhrase = $"Internal data base error please check server logs"
         };
         throw new HttpResponseException(resp);
     }
 }