added debugging str

This commit is contained in:
taywon 2024-05-19 19:23:32 +02:00
parent 3ca5768d6e
commit 6572836716
3 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,11 @@ public class Transmitter
foreach (Element element in elements)
triplets.AddRange(Translator.Encode(element));
await Client.PostAsJsonAsync(uri, triplets, cancellationToken: tk);
var result = await Client.PostAsJsonAsync(uri, triplets, cancellationToken: tk);
if (!result.IsSuccessStatusCode)
throw new Exception($"SendAsync call return code {result.StatusCode} when call {uri}.");
}
public async Task SendAsync(Uri uri, IEnumerable<Event> events, CancellationToken tk = default)
@ -31,9 +35,7 @@ public class Transmitter
Uri uri = new Uri(BaseUrl, "Push/Elements");
var result = await Client.PostAsJsonAsync(uri, elements, tk);
if (!result.IsSuccessStatusCode)
throw new Exception($"SendAsync call return code {result.StatusCode} when call {uri}.");
await SendAsync(uri, elements, tk);
}
public async Task SendAsync(Element element, CancellationToken tk = default)

View File

@ -1,5 +1,5 @@
{
"Url":"http://salmon.voie93quarts.fr/api/Push",
"Url":"http://salmon.voie93quarts.fr/api/",
"Period":15000,
"Watch":[
{

View File

@ -32,7 +32,7 @@ public class TripletJsonConverter
Debug.Assert(reader.TokenType == JsonTokenType.String);
ret.predicate = reader.GetString();
}
else if(jsonkey == nameof(Triplet.LastFlush))
else if(jsonkey.ToLower() == nameof(Triplet.LastFlush).ToLower())
{
Debug.Assert(reader.TokenType == JsonTokenType.String);
ret.LastFlush = reader.GetDateTime();
@ -52,6 +52,8 @@ public class TripletJsonConverter
else
throw new NotImplementedException($"Cannot read Triple.value from token type {reader.TokenType}.");
}
else
Console.WriteLine($"Unknown triplet field {jsonkey} with token type {reader.TokenType}.");
}
return ret;