Handling by on error seems little bit clumsy to me.  I believe modern browsers are optimized so it may cache the image so 2nd image load will be network traffic less in situation where state change to new or removed.  

Although seeing error line in console make me a grumpy cat, I'm not clever enough to see more cleaner solution without structure of how we are handling image diff.