From 323ff67badfc46ad638d75f059d60d9425ccb2fa Mon Sep 17 00:00:00 2001 From: vnugent Date: Sun, 10 Mar 2024 15:50:07 -0400 Subject: ci(server): Conainerize and add vncache server packages --- .../src/ApiModel/CacheSiteAdapter.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/VNLib.Data.Caching.Extensions') 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) { -- cgit