diff options
Diffstat (limited to 'lib/VNLib.Data.Caching.Extensions/src/ApiModel')
-rw-r--r-- | lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs b/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs index b6add7d..6edb912 100644 --- a/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs +++ b/lib/VNLib.Data.Caching.Extensions/src/ApiModel/CacheSiteAdapter.cs @@ -24,6 +24,7 @@ using System; using System.Net; +using System.Security; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -72,7 +73,23 @@ namespace VNLib.Data.Caching.Extensions.ApiModel } public override void OnResponse(RestResponse response) - { } + { + switch(response.StatusCode) + { + case HttpStatusCode.OK: + break; + case HttpStatusCode.Unauthorized: + throw new SecurityException("Unauthorized access to cache service"); + case HttpStatusCode.Forbidden: + throw new SecurityException("Forbidden access to cache service"); + case HttpStatusCode.NotFound: + throw new InvalidOperationException("Cache service not found"); + case HttpStatusCode.InternalServerError: + throw new InvalidOperationException("Cache service internal error"); + default: + throw new InvalidOperationException($"Cache service error: {response.StatusCode}"); + } + } public override Task WaitAsync(CancellationToken cancellation = default) { |