ValueObject validation in CQRS Commands #429
Unanswered
Chris-Mingay
asked this question in
Q&A
Replies: 1 comment
-
My initial thoughts is to try and catch an exception but I am not sure if that's sensible |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've added a
public string Colour
property toCreateTodoListCommand
and I process it as followsThe following API call for
POST /api/TodoLists
works as expectedLikewise if I were to post the exact same data again, I would get the following expected error
However when I attempt to POST with an invalid colour like the following ...
I get this response ...
This is understandable because the command doesn't check/catch the domain level validation error however it doesn't help the client consuming the API. A client might think they are presenting a valid colour string, however according to the domain it obviously isn't.
so my question is
How should I go about presenting ValueObject level validation errors in an Application level response?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions