-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Rust panic in tauri_plugin_fs_extra from crash reporting in our installbase #1778
Comments
Le chatgpt O1 says: Here's the relevant portion of the code from line 80 in fn system_time_to_ms(time: SystemTime) -> u128 {
time.duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis()
} Issue:
Solution: Modify the function to handle the
Recommendation: Option 2 is generally better practice as it doesn't hide potential errors and allows the caller to decide how to handle them. Explanation:
Additional Steps:
Why This Error Occurred:
Preventing Future Errors:
Example with Error Logging: use std::time::{SystemTime, SystemTimeError};
fn system_time_to_ms(time: SystemTime) -> Result<u128, SystemTimeError> {
match time.duration_since(SystemTime::UNIX_EPOCH) {
Ok(duration) => Ok(duration.as_millis()),
Err(e) => {
eprintln!("Error converting time: {:?}", e);
Err(e)
}
}
} Conclusion: By properly handling the Note: Always ensure that you're handling time-related functions carefully, especially when dealing with files or systems that might have timestamps before the UNIX epoch. |
Should be fixed with the linked pr above (non default branch so no auto closing...) |
Describe the bug
We've recently integrated Bugsnag for crash reporting in our app phcode.io. This report summarizes a recurring crash issue observed in macOS.
Overview
Crash Details
tauri_plugin_fs_extra::system_time_to_ms
. The crashes are pointing to this single function in all stacks. See stack below.Reproduction
This is crash reporting from our installbase.
This looks like the offending code: https://github.com/tauri-apps/tauri-plugin-fs-extra/blob/v1/src/lib.rs#L80
Expected behavior
no crash
Full
tauri info
outputStack trace
Additional context
The text was updated successfully, but these errors were encountered: