Skip to content

Commit

Permalink
gvfa: mproved error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Aug 19, 2020
1 parent d68859a commit 684bb14
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/graphviewer/gvfa.py
Expand Up @@ -187,8 +187,10 @@ def agraph(nodeinfo: NodeInput = Depends(),
reduction = nx.transitive_reduction(g)
g = g.edge_subgraph([(u, v, k) for u, v, k, _ in expand_edges(g, reduction.edges)])
else:
raise ValueError(
'Cannot produce transitive reduction – the subgraph is not acyclic after removing conflict edges!')
raise HTTPException(500, dict(
error="not-acyclic",
msg='Cannot produce transitive reduction – the subgraph is not acyclic after removing conflict edges!',
dot=write_dot(g, target=None, highlight=nodes).to_string()))

g = simplify_timeline(g)

Expand Down
17 changes: 15 additions & 2 deletions src/graphviewer/templates/form.html
Expand Up @@ -207,8 +207,21 @@
})
//.then(() => message())
.catch(reason => {
addLongMessage(`<pre>${reason}</pre>`, "danger")
console.error(reason)
try {
const details = JSON.parse(reason).detail;
console.error(details);
if (details.msg) {
addLongMessage(details.msg, 'danger')
} else {
addLongMessage(`<pre>${details}</pre>`, "danger")
}
if (details.dot) {
graphviz.transition(transitionFactory).renderDot(details.dot);
}
} catch (e) {
addLongMessage(`<pre>${reason}</pre>`, "danger")
console.error(reason)
}
});
updateURLs(formdata);
if (formdata.get('dir').includes('B')) { // vertical layout
Expand Down

0 comments on commit 684bb14

Please sign in to comment.