[#8] refactoring how lengths are added to error messages