If I have aquired a backtrace, e.g. from backtrace()
and i want to throw an exception that impersonates an exception being thrown with that backtrace, how do i do it?
found in the julia source code marked a pseudocode:
function throw(val)
global catch_backtrace = backtrace()
rethrow(val)
end
Now sure that will work though
Couldn’t you just create your own exception type to wrap the actually thrown expression and your fake backtrace (also define display_backtrace
etc for proper printing and so on)?
yeah, that would do it.
I thought there might be an inbuilt way.
since rethrow(e)
basically does this.
Throwning the new exception e
with the old backtrace, right?