From 509c2786afb701aba6c1caf8a150ab9bc2eba4ed Mon Sep 17 00:00:00 2001
From: Heinrichs <Heinrichs@itc.rwth-aachen.de>
Date: Wed, 22 Sep 2021 10:37:44 +0200
Subject: [PATCH] Update: Add Logs and Docs (coscine/issues#1711)
---
README.md | 33 ++------------------------
src/Blob/Controllers/BlobController.cs | 13 ++++++----
2 files changed, 11 insertions(+), 35 deletions(-)
diff --git a/README.md b/README.md
index 07fd7a1..84a2400 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,3 @@
-## C# Template
+# Blob API
-This template includes:
-
-* Automatic building using cake
-* Automatic testing with NUnit
-* Automatic linting with Resharper
-* Automatic documentation publishing using Gitlab CI / CD and a self written script which puts the docs in the docs folder to the wiki
-* Automatic releases using semantic-release ([ESLint Code Convention](docs/ESLintConvention)), cake and Gitlab CI / CD
-
-## What you need to do
-
-Place you C# project solution file in .src/.
-Make sure Create directory for solution is unticked.
-
-
-
-Delete unused docs and update this README.
-
-Add [NUnit](docs/nunit.md) tests to your solution.
-
-## Building
-
-Build this project by running either the build.ps1 or the build<span></span>.sh script.
-The project will be build and tested.
-
-### Links
-
-* [Commit convention](docs/ESLintConvention.md)
-* [Everything possible with markup](docs/testdoc.md)
-* [Adding NUnit tests](docs/nunit.md)
-
+This API handles the connection to the data stored in Coscine.
diff --git a/src/Blob/Controllers/BlobController.cs b/src/Blob/Controllers/BlobController.cs
index 55e0989..4b44b21 100644
--- a/src/Blob/Controllers/BlobController.cs
+++ b/src/Blob/Controllers/BlobController.cs
@@ -122,8 +122,9 @@ namespace Coscine.Api.Blob.Controllers
var totalFileSize = resourceTypeDefinition.GetResourceQuotaUsed(resourceId, resourceTypeOptions).Result;
return Ok($"{{ \"data\": {{ \"usedSizeByte\": {totalFileSize} }}}}");
}
- catch
+ catch (Exception e)
{
+ _coscineLogger.Log("Get Quota failed", e);
return BadRequest($"Error in communication with the resource");
}
}
@@ -174,8 +175,9 @@ namespace Coscine.Api.Blob.Controllers
LogAnalytics("Download File", resourceId, path.Substring(1), user);
return File(response, contentType ?? "application/octet-stream");
}
- catch
+ catch (Exception e)
{
+ _coscineLogger.Log("Get File failed", e);
return BadRequest($"Error in communication with the resource");
}
}
@@ -252,6 +254,7 @@ namespace Coscine.Api.Blob.Controllers
}
catch (Exception e)
{
+ _coscineLogger.Log("Upload File failed", e);
return BadRequest($"Error in communication with the resource");
}
}
@@ -300,8 +303,9 @@ namespace Coscine.Api.Blob.Controllers
LogAnalytics("Delete File", resourceId, path, user);
return NoContent();
}
- catch
+ catch (Exception e)
{
+ _coscineLogger.Log("Delete failed", e);
return BadRequest($"Error in communication with the resource");
}
}
@@ -339,8 +343,9 @@ namespace Coscine.Api.Blob.Controllers
await resourceTypeDefinition.IsResourceCreated("", resourceTypeOptions);
return NoContent();
}
- catch
+ catch (Exception e)
{
+ _coscineLogger.Log("Resource validation failed", e);
return BadRequest($"Error in communication with the resource");
}
}
--
GitLab