This commit is contained in:
2020-06-13 19:23:39 +00:00
parent dd4a4cb68c
commit a306b84c01
2 changed files with 22 additions and 4 deletions

View File

@@ -117,9 +117,17 @@ namespace AyaNova.Api.Controllers
try
{
var ret = await AyaNova.Core.License.FetchKeyAsync(serverState, ct, log, false);
//Log
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseFetch), ct);
//most often the result will be not found but in future might be other results
//main thing is to not log anything but OK response
if (ret == "ok")
{
//Log
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseFetch), ct);
}
//any response here is OK, there's not necessarily an error, just no key or some mundane problem not technical but biz so let
//ret string instruct client on what to do
return Ok(ret);
}
catch (Exception ex)

View File

@@ -499,14 +499,24 @@ namespace AyaNova.Core
}
return $"E1020 - Error fetching license key: No key was returned";
}
else
else{
//some kind of server error??
if((int)res.StatusCode > 499){
return $"E1020 - License server error fetching license key, contact technical support: {res.ReasonPhrase}";
}
//If it's NOT FOUND, that's not an error, just a normal response to be expected
if(res.StatusCode== System.Net.HttpStatusCode.NotFound){
return "notfound";
}
return $"E1020 - Error fetching license key: {res.ReasonPhrase}";
}
}
catch (Exception ex)
{
if (calledFromInternalJob) throw ex;
var msg = "E1020 - Error fetching license key";
var msg = "E1020 - Error fetching / installing license key";
log.LogError(ex, msg);
return msg;
}