Refactored error validation code and tests

I was a bit dogmatically reticent to add IDs because of the Angular’s
“IDs are a bad smell” saying.

The thing is that it’s not the case now: IDs in this case facititate
cleaner tests. Previously tests were testin implementation not
behaviour; with IDs it was easy to make them read better.

The other day I have watched episode 22 of CleanCoders’ and one thing
that ringed the bells for me was “write tests that you want to read”,
which was not exactly the case for these ones. ;)

This refactoring also brought some good insight for the production code.