Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include inputfile in errors #150

Merged
merged 3 commits into from
Jun 29, 2021

Conversation

st--
Copy link
Contributor

@st-- st-- commented Jun 29, 2021

When using Literate in parallel processes, it would be very helpful for debugging if the error messages would actually include the name of the original input file - as discussed in JuliaGaussianProcesses/KernelFunctions.jl#303 (comment). This PR includes a draft version of how this can be achieved. Happy to find better ways of doing it:)

@devmotion
Copy link
Contributor

include_string allows to specify a filename as additional argument. In this way the original error message that is rethrown by Literate would contain the filename automatically I assume.

Alternatively but a bit more involved, maybe one could also keep track of the line numbers and rethrow a LoadError and forward the filename and linenumber to it.

@st--
Copy link
Contributor Author

st-- commented Jun 29, 2021

Keeping track of line numbers would be difficult because the preprocess function could arbitrarily change it..

Copy link
Owner

@fredrikekre fredrikekre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think this is good enough. Line location would be nice, but since you see the code block and now know the file it should be pretty easy to find the location.

src/Literate.jl Outdated Show resolved Hide resolved
src/Literate.jl Outdated Show resolved Hide resolved
src/Literate.jl Outdated Show resolved Hide resolved
src/Literate.jl Outdated Show resolved Hide resolved
src/Literate.jl Outdated Show resolved Hide resolved
src/Literate.jl Outdated Show resolved Hide resolved
@fredrikekre fredrikekre merged commit d561b54 into fredrikekre:master Jun 29, 2021
@st-- st-- deleted the st/show_inputfile_in_errors branch June 30, 2021 11:38
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.

None yet

3 participants