add try/catch block to rasterize()