Description
The constructor NativeEngine::new currently panics using .expect(...) if libloading fails to load the dynamic library (libCrawlCipher.Core.so/CrawlCipher.Core.dll) or any of the exported functions. It also uses .unwrap() when creating CString instances, which can panic if inputs contain interior NUL bytes.
If a developer runs the game without having the core binary in place, the application crashes immediately with a raw Rust panic message, which is bad for UX.
Proposed Changes
- Refactor
NativeEngine::new to return anyhow::Result<Self> instead of panicking.
- Replace
.expect and .unwrap calls inside the constructor with proper error propagation (?).
- Catch the error in
main.rs, disable raw mode/leave alternate screen, and print a clean diagnostic error message prompting the user to check their shared library paths.
Description
The constructor
NativeEngine::newcurrently panics using.expect(...)iflibloadingfails to load the dynamic library (libCrawlCipher.Core.so/CrawlCipher.Core.dll) or any of the exported functions. It also uses.unwrap()when creatingCStringinstances, which can panic if inputs contain interior NUL bytes.If a developer runs the game without having the core binary in place, the application crashes immediately with a raw Rust panic message, which is bad for UX.
Proposed Changes
NativeEngine::newto returnanyhow::Result<Self>instead of panicking..expectand.unwrapcalls inside the constructor with proper error propagation (?).main.rs, disable raw mode/leave alternate screen, and print a clean diagnostic error message prompting the user to check their shared library paths.