antonbabenko / modules.tf-lambda

Infrastructure as code generator - from visual diagrams created with Cloudcraft.co to Terraform
https://www.cloudcraft.co/
MIT License
350 stars 56 forks source link

Incomplete edges in input json leads to a failure in rendering #9

Closed antonbabenko closed 4 years ago

antonbabenko commented 5 years ago

Sometimes there are incomplete edges in input json, which can be contracted in the graph.

ValueError: Edge ('16310948-04c7-4842-9c02-aa5a54616a40', 'a1a904b3-556e-4220-9812-011e1bbd2dfc') does not exist in graph G; cannot contract it

ValueError
Traceback (most recent call last):
  File "/var/task/handler.py", line 76, in handler
    graph = populate_graph(data)
  File "/var/task/modulestf/cloudcraft/graph.py", line 94, in populate_graph
    G = nx.contracted_edge(G, (edge[0], edge[1]), self_loops=False)
  File "/var/task/networkx/algorithms/minors.py", line 452, in contracted_edge
    ' it'.format(edge))

Expected behavior

Fail with proper error, so that user knows that input json was badly formatted.

Actual behavior

Nothing, 500 error returned to a user.

Additional context

This happens very-very seldom, so minor priority.