EEPROM reading and writing
There are various strategies to detect such failures.

A simple one works and even catches cases where your device gets powered off during a write:

Let's say you have a n byte block that you want to write:

 [ xx xx xx xx xx xx ]


Instead of just writing that block you encapsulate it with two counters an a checksum (crc for example) like this:

 [ counter1 xx xx xx xx xx xx checksum counter2]


Write algorithm:

Before you write data, first read out the old value of counter1:

  a = eeprom_read_read (counter1_offset)


Now you overwrite the data with incremented counters and a checksum:

  eeprom_write(counter1_offset, a+1);
  eeprom_write(data_offset, data);
  eeprom_write(checksum_offset, calc_checksum...);
  eeprom_write(counter2_offset, a+1);


Read algorithm:

If you want to access your data in the eeprom, always read the counters and the checksum along with the data. If counter1 differs from counter2 you likely had a power failure during the write operation. If the counters are the same but the checksum does not match you have a bad eeprom cell.