So, for language interop reasons, I’d like to translate Julia exceptions into a different kind of error. In the C API, it is pretty clear that
jl_exception_occurred is what to use to check if an exception occurred or not. But, if an exception has occurred, I haven’t found it clear how to extract the error message from it. Some exceptions seem to have the
msg field, but others (like
DomainError) do not.
Is it possible to get the message of an arbitrary exception as a string? For
DomainError thrown by
sqrt(-1), this would be:
ERROR: DomainError: sqrt will only return a complex result if called with a complex argument. Try sqrt(complex(x)). in sqrt(::Int64) at ./math.jl:211