You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err`
value: Utf8Error { valid_up_to: 0, error_len: Some(1) }', /checkout/src/libcore/result.rs:906:4
I've tried wrapping it in a thread but that failed.
In Rust, panic is safe and per-thread. The boundaries between threads serve as a firewall for panic;
Programming Rust by Jim Blandy, Jason Orendorff
I then found Rust's std::panic::catch_unwind which according to the original RFC is meant to handle such panics from C method calls. The catch_unwind doc has this note:
Note that this function may not catch all panics in Rust. A panic in Rust is not always implemented via unwinding, but can be implemented by aborting the process as well. This function only catches unwinding panics, not those that abort the process.
I have thus far been unable to catch the panic from this and looking up the error Utf8Error it would seem that that is a side effect of the kind of methods used from libruby for RString and that error isn't written in ruru.
The text was updated successfully, but these errors were encountered:
use ruru::{AnyException,Exception,Object,VM};
# VM::init();assert_eq!(AnyException::new("StandardError",Some("something went wrong")).full_string(),"StandardError: something went wrong");
Here's what Ruby gives you when you're in irb:
"\e[1mTraceback \e[m(most recent call last):\n(irb):10:in `full_message': \e[1msomething went wrong (\e[4;1mStandardError\e[m\e[1m)\n\e[m"
Ruby has this particular string in it's own test suite:
https://github.com/ruby/ruby/blob/b67ead14521fb74bcf8ec28f8c78245dfb536b70/test/ruby/test_dir_m17n.rb#L72
This will cause ruru to panic:
I've tried wrapping it in a thread but that failed.
I then found Rust's std::panic::catch_unwind which according to the original RFC is meant to handle such panics from C method calls. The catch_unwind doc has this note:
I have thus far been unable to catch the panic from this and looking up the error Utf8Error it would seem that that is a side effect of the kind of methods used from libruby for RString and that error isn't written in ruru.
The text was updated successfully, but these errors were encountered: