oprava datumu: prijem data bez zony jako UTC
SDK validuje Post/Patch modely pred odeslanim a u kazde polozky DateTime vyzaduje Kind == Utc. Datum bez zony, napriklad "2026-08-25", nacetl Newtonsoft jako Unspecified, takze POST /issued-invoices koncil chybou "DateTime must be in UTC format" jeste pred volanim iDokladu. - DateTimeZoneHandling.Utc: hodnota bez zony dostane Kind Utc bez posunu, hodnota s offsetem se prepocita do UTC - ExceptionHandlingMiddleware zachytava IdokladValidationException a vraci 400 se seznamem vadnych vlastnosti misto prazdne 500 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
2f3afb6af0
commit
73f01d0228
@@ -52,6 +52,16 @@ public sealed class ExceptionHandlingMiddleware
|
||||
["idokladError"] = ex.AuthenticationError?.Error,
|
||||
});
|
||||
}
|
||||
catch (IdokladValidationException ex)
|
||||
{
|
||||
// The SDK validates Post/Patch models before sending them. This does not derive from
|
||||
// IdokladBaseException, so without this catch the request ended as an empty 500.
|
||||
_logger.LogWarning("iDoklad model validation failed: {Message}", ex.Message);
|
||||
await WriteProblem(context, HttpStatusCode.BadRequest, ex.Message, new Dictionary<string, object?>
|
||||
{
|
||||
["invalidProperties"] = ex.InvalidProperties?.Keys.ToArray(),
|
||||
});
|
||||
}
|
||||
catch (IdokladBaseException ex)
|
||||
{
|
||||
// Other SDK-level failures (malformed responses, batch errors, etc.).
|
||||
|
||||
Reference in New Issue
Block a user