Catch error for cog graph [pydot 1.0.28]