added passing exception ptr to draw image function for handling error in
work