Files
BeWoPlaner/Service/Api/ErrorExtractor/DefaultErrorExtractor.cs

30 lines
585 B
C#
Raw Normal View History

2025-07-03 13:55:46 +02:00
using BS.Shared.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace BeWo.Service.Api.ErrorExtractor
{
public class DefaultErrorExtractor : IApiErrorExtractor
{
public IEnumerable<string> ExtractError(string json)
{
var result = new List<string>();
using (var doc = JsonDocument.Parse(json))
{
if (doc.RootElement.TryGetProperty("error", out var error))
{
result.Add(error.ToString());
return result;
}
};
return null;
}
}
}