Catch illegal argument exception for outputing response for images