imageinfo: replace assert() with exception raise

Exception UnexpectedError may be raised if for some reason data parsing fails.