Throwing and handling error exceptions when trying to create a bad image type