JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
267 stars 36 forks source link

If julia functions which was brought to R throws an error, no real error is thrown, but an error object is returned #216

Open schlichtanders opened 11 months ago

schlichtanders commented 11 months ago

JuliaCall does not throw errors correctly.

R> library(JuliaCall)

R> f = julia_eval('f() = error("hi")')
┌ Warning: RCall.jl: Julia version 1.9.3 at location /nix/store/n2mf5wwcjasd5wlxinrz36y0g6l0w7q8-julia-bin-1.9.3/bin will be used.
│ Loading setup script for JuliaCall...
└ @ RCall ~/.julia/packages/RCall/gOwEW/src/io.jl:172
┌ Warning: RCall.jl: Finish loading setup script for JuliaCall.
└ @ RCall ~/.julia/packages/RCall/gOwEW/src/io.jl:172

R> f()
<simpleError: ErrorException("hi")>

This should throw a real error instead of returning an error object.

Do you know a workaround?

schlichtanders commented 11 months ago

Also the error only includes the plain message. Often one also needs the stacktrace.

Please also include the stacktrace in the simpleError message when fixing this.

schlichtanders commented 11 months ago

Turns out this is an RCall.jl problem