Closed YOU54F closed 1 year ago
Got back to messing about with this this eve.
can just test for the directories existence and create it.
FileUtils.mkdir_p 'logs' unless File.directory?('logs')
also noted if LevelFilter is set to 0
it panics too
PactRubyFfi.pactffi_logger_attach_sink('stderr', PactRubyFfi::FfiLogLevelFilter['LOG_LEVEL_OFF'])
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', pact_ffi/src/log/logger.rs:76:95
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Huh! Comment in the code:
// Safe to unwrap here, as the previous FFI step would have validated the sink and returned // an error back to the caller if the sink could not be constructed. Also the level filter will // never create a level that can't be unwrapped
I'll update that comment to be: Also the level filter will never create a level that can't be unwrapped unless it is for Yousaf :-D
Fixed
Hey hey
Just started playing about with the FFI, as I wanted to get Ruby moving in the right direction
The following command fails when called, with a directory that doesn't exist, should this be handled by the rust-core?
either
My expectations on error handling come from
https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/ARCHITECTURE.md#error-handling
And my logging is setup as per
https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/ARCHITECTURE.md#logging
dump (reduced)