AVR Error Handling: I2C, SPI etc
The I2C module provides a way to identify erros, once you send, let's say a START condition or whatever you have to verify the TWSR register (TWI Status register) and it should match the state you are expecting (e.g. Aknowledge from slave). There is a flow diagram for each working mode showcasing the different status values.