Skip to content

Commit 746cdc3

Browse files
committed
refactor: simplified preload error handling
BREAKING CHANGE: removed `FetchError::PreloadNotFound`
1 parent c9808fb commit 746cdc3

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

packages/perseus/src/errors.rs

-3
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,6 @@ pub enum FetchError {
369369
source: Box<dyn std::error::Error + Send + Sync>,
370370
ty: AssetType,
371371
},
372-
// This is not used by the `fetch` function, but it is used by the preloading system
373-
#[error("preload asset fetched from '{url}' was not found")]
374-
PreloadNotFound { url: String, ty: AssetType },
375372
/// This converts from a `JsValue` or the like.
376373
#[error("the following error occurred while interfacing with JavaScript: {0}")]
377374
Js(String),

packages/perseus/src/state/state_store.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl PageStateStore {
303303
is_widget: bool,
304304
) -> Result<(), crate::errors::ClientError> {
305305
use crate::{
306-
errors::{AssetType, FetchError},
306+
errors::{AssetType, ClientPreloadError, FetchError},
307307
utils::{fetch, get_path_prefix_client},
308308
};
309309

@@ -360,9 +360,8 @@ impl PageStateStore {
360360
preloaded.insert(full_path, page_data);
361361
Ok(())
362362
}
363-
None => Err(FetchError::PreloadNotFound {
364-
url: path.to_string(),
365-
ty: asset_ty,
363+
None => Err(ClientPreloadError::PreloadNotFound {
364+
path: path.to_string(),
366365
}
367366
.into()),
368367
}

0 commit comments

Comments
 (0)