September 2018
Intermediate to advanced
764 pages
20h 6m
English
At the moment, the generateValidationErrorMessage function produces messages that are specific to the Create User operations. This means that although the code is separated, the logic is still highly coupled to the Create User endpoint. This coupling defeats the purpose of modules; it is a code smell that should be eliminated.
Instead, we should program the generateValidationErrorMessage function to be able to generate error messages for all validation errors. Doing so also provides local consistency, because all validators will now have a consistent structure/format for their error messages.
So, let's make the change by replacing our generateValidationErrorMessage function with the following:
function generateValidationErrorMessage(errors) ...
Read now
Unlock full access