Switch SnapshotMiddleware over to SnapshotError

This commit is contained in:
Lucien Greathouse
2019-10-09 12:42:08 -07:00
parent a14aacbcf9
commit 28156bcaf2
4 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
use std::{error::Error, fmt, io, path::PathBuf}; use std::{error::Error, fmt, io, path::PathBuf};
use crate::{imfs::FsError, snapshot::InstanceSnapshot}; use crate::imfs::FsError;
#[derive(Debug)] #[derive(Debug)]
pub struct SnapshotError { pub struct SnapshotError {

View File

@@ -3,11 +3,13 @@ use std::path::{Path, PathBuf};
use rbx_dom_weak::{RbxId, RbxTree}; use rbx_dom_weak::{RbxId, RbxTree};
use crate::{ use crate::{
imfs::{FsResult, Imfs, ImfsEntry, ImfsFetcher, ImfsSnapshot}, imfs::{Imfs, ImfsEntry, ImfsFetcher, ImfsSnapshot},
snapshot::InstanceSnapshot, snapshot::InstanceSnapshot,
}; };
pub type SnapshotInstanceResult<'a> = FsResult<Option<InstanceSnapshot<'a>>>; use super::error::SnapshotError;
pub type SnapshotInstanceResult<'a> = Result<Option<InstanceSnapshot<'a>>, SnapshotError>;
pub type SnapshotFileResult = Option<(String, ImfsSnapshot)>; pub type SnapshotFileResult = Option<(String, ImfsSnapshot)>;
pub trait SnapshotMiddleware { pub trait SnapshotMiddleware {

View File

@@ -17,6 +17,8 @@ mod rbxm;
mod rbxmx; mod rbxmx;
mod txt; mod txt;
pub use self::error::*;
use rbx_dom_weak::{RbxId, RbxTree}; use rbx_dom_weak::{RbxId, RbxTree};
use self::{ use self::{

View File

@@ -29,7 +29,7 @@ impl SnapshotMiddleware for SnapshotProject {
match imfs.get(project_path) { match imfs.get(project_path) {
Err(ref err) if err.kind() == FsErrorKind::NotFound => {} Err(ref err) if err.kind() == FsErrorKind::NotFound => {}
Err(err) => return Err(err), Err(err) => return Err(err.into()),
// TODO: Do we need to muck with the relevant paths if we're a // TODO: Do we need to muck with the relevant paths if we're a
// project file within a folder? Should the folder path be the // project file within a folder? Should the folder path be the