Currently, all C++ exceptions get turned into strings and fed into Lua. Panics in Lua are then converted back to std::runtime_error's with what() set to the Lua error message and stacktrace information.
In my application I'm using custom C++ exceptions, so being able to store original exception information would be very useful for me. I was looking at Lua + Sol2 but I've switched to Chaiscript
Request 1: Preserve std::exception_ptr in sol::error
Scope of changes
Support pushing std::exception_ptr to the stack
In the default exception handler, push exception_ptr, then push the string error message
In the default panic handler, grab the string message, then peek the stack. If the stack contains a exception_ptr, then add it to sol::error
Request 2: Remove stacktrace from sol::error::what()
Scope of changes
Add a stacktrace (maybe just a vector of strings) to sol::error
Instead of appending the stacktrace to the error message, set it to the field
I'm currently working on a dirty hack for request 1, I wanted to get a sense of whether you would accept these changes back into tree and what potential pitfalls you may see.
Take this code:
Godbolt sample: https://godbolt.org/z/e9W1oPf9f
Currently, all C++ exceptions get turned into strings and fed into Lua. Panics in Lua are then converted back to
std::runtime_error
's withwhat()
set to the Lua error message and stacktrace information.In my application I'm using custom C++ exceptions, so being able to store original exception information would be very useful for me. I was looking at Lua + Sol2 but I've switched to Chaiscript
Request 1: Preserve
std::exception_ptr
insol::error
Scope of changes
sol::error
Request 2: Remove stacktrace from
sol::error::what()
Scope of changes
sol::error
I'm currently working on a dirty hack for request 1, I wanted to get a sense of whether you would accept these changes back into tree and what potential pitfalls you may see.