Invokes `func` (e.g. GetPydotGraph) with args. If anything fails - returns and empty image instead of throwing Exception
(func, *args, **kwargs)
| 328 | |
| 329 | |
| 330 | def GetGraphPngSafe(func, *args, **kwargs): |
| 331 | """ |
| 332 | Invokes `func` (e.g. GetPydotGraph) with args. If anything fails - returns |
| 333 | and empty image instead of throwing Exception |
| 334 | """ |
| 335 | try: |
| 336 | graph = func(*args, **kwargs) |
| 337 | if not isinstance(graph, pydot.Dot): |
| 338 | raise ValueError("func is expected to return pydot.Dot") |
| 339 | return graph.create_png() |
| 340 | except Exception as e: |
| 341 | logger.error("Failed to draw graph: {}".format(e)) |
| 342 | return _DummyPngImage |
| 343 | |
| 344 | |
| 345 | def main(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…