Skip to content

Add basic exception handling - #39

Open
frankier wants to merge 1 commit into
JuliaGraphs:mainfrom
frankier:error-handling
Open

Add basic exception handling#39
frankier wants to merge 1 commit into
JuliaGraphs:mainfrom
frankier:error-handling

Conversation

@frankier

Copy link
Copy Markdown

Consider a dot literal:

dot"""
graph G{
a -> b
}
"""

Currently this will give an assertion exception when layout discovers the graph.handle is C_NULL. Actually Graphviz is confused that there is a -> and it's not a digraph.

This PR handles null return values from the cgraph functions immediately and converts them into Julia exceptions. Unfortunately this does not give very good error messages (the actual error message is still just printed to stderr), however it's a bit better than the current situation, which is even less since nice in Pluto.jl since stderr is currently not routed to the Notebook by default.

I made an attempt to try and capture the error message in jl_putstr and jlio_write so that it could be put onto the exception, but this did not work out. For some reason Graphviz is not routing the error messages through these callbacks.

@codecov

codecov Bot commented Feb 11, 2022

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@Keno

Keno commented Feb 11, 2022

Copy link
Copy Markdown
Contributor

Could you add a testcase for the new behavior? I think there's a separate callback (agusererrf) for capturing error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants