mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
Enhance StdBackend with critical error handling and improve file watcher reliability
- Introduced `WatcherCriticalError` enum to categorize critical errors from the file watcher. - Added a `CriticalErrorHandler` callback type for custom error handling in the watcher thread. - Updated `StdBackend` to include a receiver for critical errors, allowing for better error management and logging. - Refactored the watcher thread to handle errors gracefully instead of terminating the process, improving overall stability.
This commit is contained in:
parent
78aab0eca4
commit
41363473b2
27 changed files with 409 additions and 173 deletions
|
|
@ -29,7 +29,7 @@ use std::{io, str};
|
|||
pub use in_memory_fs::InMemoryFs;
|
||||
pub use noop_backend::NoopBackend;
|
||||
pub use snapshot::VfsSnapshot;
|
||||
pub use std_backend::StdBackend;
|
||||
pub use std_backend::{CriticalErrorHandler, StdBackend, WatcherCriticalError};
|
||||
|
||||
mod sealed {
|
||||
use super::*;
|
||||
|
|
@ -639,7 +639,7 @@ mod test {
|
|||
let file_path = dir.path().join("file.txt");
|
||||
fs_err::write(&file_path, contents.to_string()).unwrap();
|
||||
|
||||
let vfs = Vfs::new(StdBackend::new());
|
||||
let vfs = Vfs::new(StdBackend::new_for_testing());
|
||||
let canonicalized = vfs.canonicalize(&file_path).unwrap();
|
||||
assert_eq!(canonicalized, file_path.canonicalize().unwrap());
|
||||
assert_eq!(
|
||||
|
|
@ -653,7 +653,7 @@ mod test {
|
|||
let dir = tempfile::tempdir().unwrap();
|
||||
let file_path = dir.path().join("test");
|
||||
|
||||
let vfs = Vfs::new(StdBackend::new());
|
||||
let vfs = Vfs::new(StdBackend::new_for_testing());
|
||||
let err = vfs.canonicalize(&file_path).unwrap_err();
|
||||
assert_eq!(err.kind(), io::ErrorKind::NotFound);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue