Image generator: better exception handling