The "solution" to keep check and related error message dry looks more like a workaround.
Issues:
The (probably expensive) check is run twice.
It relies on any state considered by check being identical at the time of the check and the time when getValidationErrorMessage is called. One candidate for a non-identical world state is e.g. a new Date().
Instead, the check should be able to leave check (failure) details which are provided to (e.g.) getValidationErrorMessage.
The "solution" to keep check and related error message dry looks more like a workaround.
Issues:
getValidationErrorMessage
is called. One candidate for a non-identical world state is e.g. anew Date()
.Instead, the check should be able to leave check (failure) details which are provided to (e.g.)
getValidationErrorMessage
.