Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
f7488dd
stash
katrinafyi Oct 4, 2025
a9fe9ad
stash very broken
katrinafyi Oct 4, 2025
cef997e
Revert "stash very broken"
katrinafyi Oct 4, 2025
25f130b
Revert "stash"
katrinafyi Oct 4, 2025
d272a2b
feat: add CreateRequestItem error kind
katrinafyi Oct 4, 2025
f5fd8df
wrap
katrinafyi Oct 4, 2025
e4c5482
smuggle request errors through CreateRequestItem
katrinafyi Oct 4, 2025
963b276
stash Result with RawUri
katrinafyi Oct 4, 2025
9461325
Revert "stash Result with RawUri"
katrinafyi Oct 4, 2025
c1bd7ca
add help
katrinafyi Oct 4, 2025
65afcdd
add CollectResult to be less dubious
katrinafyi Oct 4, 2025
891255d
fix lints
katrinafyi Oct 4, 2025
ff87745
touch
katrinafyi Oct 4, 2025
024772a
introduce separate RequestError type. but...
katrinafyi Oct 5, 2025
3ee280e
add Status::RequestError
katrinafyi Oct 5, 2025
1ad2020
mark as error
katrinafyi Oct 5, 2025
25d32ce
remove ErrorKind::CreateRequestItem case
katrinafyi Oct 5, 2025
c7536d1
blah
katrinafyi Oct 5, 2025
d10190a
uncomment
katrinafyi Oct 5, 2025
4f74a77
restore old panic behaviour for input-source errors
katrinafyi Oct 5, 2025
3bca6c8
docs
katrinafyi Oct 5, 2025
49c550e
remove unused imports
katrinafyi Oct 5, 2025
6a007c2
fix example
katrinafyi Oct 7, 2025
d7ebbc0
clippy. includes boxing errorkind because it's big
katrinafyi Oct 7, 2025
17fad2c
propagate input loading errors too
katrinafyi Oct 7, 2025
976904a
handle is no longer fallible. add helper function
katrinafyi Oct 7, 2025
f0eda83
Delete clippy.toml
katrinafyi Oct 9, 2025
704ad98
Revert "Delete clippy.toml"
katrinafyi Oct 9, 2025
e5152cc
explain ignore-interior-mutability
katrinafyi Oct 9, 2025
6c959f3
Merge remote-tracking branch 'upstream/master' into propagate-early-e…
katrinafyi Oct 23, 2025
eef8b78
fix compilation
katrinafyi Oct 23, 2025
1a1b5df
review: add new error case for user-provided input failures, but
katrinafyi Oct 23, 2025
f331dbe
lint
katrinafyi Oct 23, 2025
5716ee9
move UserInputContent case into fn handle
katrinafyi Oct 24, 2025
300e368
try fix lint. help welcome. i can't compile this for some reason
katrinafyi Oct 24, 2025
e22f13c
add early checking for file and dir permissions (and fmt πŸ™Š)
katrinafyi Oct 24, 2025
5cc0c1b
lint
katrinafyi Oct 24, 2025
45906e8
use DirTraversal error for dir failures
katrinafyi Oct 24, 2025
2397577
update tests, including adjusting existing
katrinafyi Oct 24, 2025
802427b
remove "Skip relative URLs" from readme feature table
katrinafyi Oct 24, 2025
fe04a7c
Merge remote-tracking branch 'upstream/master' into propagate-early-e…
katrinafyi Nov 12, 2025
c594f6b
lint;
katrinafyi Nov 12, 2025
048edd6
fix invalid glob test
katrinafyi Nov 12, 2025
df91d1e
Preprocessor PathBuf
katrinafyi Nov 13, 2025
347a030
Revert "Preprocessor PathBuf"
katrinafyi Nov 13, 2025
33141c9
review comments aside from struct variant
katrinafyi Nov 13, 2025
012fd68
lint
katrinafyi Nov 13, 2025
8c34cf4
capitalise paragraph comments
katrinafyi Nov 13, 2025
e066600
comment for internal function
katrinafyi Nov 13, 2025
918e216
add light test case test_create_request_from_relative_file_path_errors
katrinafyi Nov 13, 2025
acfa23c
comment2
katrinafyi Nov 13, 2025
759b691
RequestBatch
katrinafyi Nov 16, 2025
bbbd94b
Revert "RequestBatch"
katrinafyi Nov 16, 2025
b7bb174
use Vec<Result<..>>
katrinafyi Nov 16, 2025
438a2d3
add LycheeResult to disambiguate from std Result
katrinafyi Nov 16, 2025
50e91d1
manually deduplicate valid requests but not errors.
katrinafyi Nov 16, 2025
8a6bc3f
change preprocessor tests to expect link checking errors
katrinafyi Nov 16, 2025
9a34dac
clippy
katrinafyi Nov 16, 2025
64be9a3
Merge remote-tracking branch 'upstream/master' into propagate-early-e…
katrinafyi Nov 16, 2025
6db8db4
merge main_command removal
katrinafyi Nov 16, 2025
25b1290
change to `error:` and add into_response helper function
katrinafyi Nov 16, 2025
70f793b
move request_error into separate file.
katrinafyi Nov 16, 2025
a6ba2a1
revert
katrinafyi Nov 16, 2025
ec943db
remove box (thanks to Thomas Zahner)
katrinafyi Nov 17, 2025
fdbf533
use lazylock
katrinafyi Nov 17, 2025
5aff2e6
inline errs_iter and reqs_iter with parentheses
katrinafyi Nov 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review: add new error case for user-provided input failures, but
should this just be a boolean in GetInputContent case?
  • Loading branch information
katrinafyi committed Oct 23, 2025
commit 1a1b5df9f179389bab3ab56b6df041f3f4f3fe5e
4 changes: 4 additions & 0 deletions lychee-bin/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ where
{
tokio::pin!(requests);
while let Some(request) = requests.next().await {
if let Err(e @ RequestError::UserInputContent { .. }) = request {
return Err(e.into_error());
}

if let Some(pb) = &bar {
pb.inc_length(1);
if let Ok(request) = &request {
Expand Down
4 changes: 4 additions & 0 deletions lychee-bin/src/commands/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ where
let mut writer = super::create_writer(params.cfg.output)?;

while let Some(request) = requests.next().await {
if let Err(e @ RequestError::UserInputContent { .. }) = request {
return Err(e.into_error());
}

let mut request = match request {
Ok(x) => x,
Err(e) => {
Expand Down
17 changes: 9 additions & 8 deletions lychee-lib/src/types/input/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,24 @@ impl Input {
resolver: UrlContentResolver,
excluded_paths: PathExcludes,
) -> impl Stream<Item = std::result::Result<InputContent, RequestError>> {
let source = self.source.clone();
try_stream! {
let source = self.source.clone();

let user_input_error = move |e: ErrorKind| RequestError::UserInputContent(source.clone(), Box::new(e));
let discovered_input_error = |e: ErrorKind| RequestError::GetInputContent(self.source.clone(), Box::new(e));

// Handle simple cases that don't need resolution
match self.source {
InputSource::RemoteUrl(url) => {
match resolver.url_contents(*url).await {
Err(_) if skip_missing => (),
Err(e) => Err(e)?,
Err(e) => Err(e).map_err(user_input_error)?,
Ok(content) => yield content,
}
return;
}
InputSource::Stdin => {
yield Self::stdin_content(self.file_type_hint).await?;
yield Self::stdin_content(self.file_type_hint).await.map_err(user_input_error)?;
return;
}
InputSource::String(ref s) => {
Expand Down Expand Up @@ -231,24 +235,21 @@ impl Input {
log::warn!("Skipping file with invalid UTF-8 content: {}", path.display());
}
},
Err(e) => Err(e)?,
Err(e) => Err(e).map_err(discovered_input_error)?,
Ok(content) => {
sources_empty = false;
yield content
}
}
},
Err(e) => Err(e)?,
Err(e) => Err(e).map_err(discovered_input_error)?,
}
}

if sources_empty {
log::warn!("{}: No files found for this input source", self.source);
}
}
.map(move |result|
result.map_err(|e| RequestError::GetInputContent(source.clone(), Box::new(e)))
)
}

/// Create a `WalkBuilder` for directory traversal
Expand Down
13 changes: 11 additions & 2 deletions lychee-lib/src/types/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,30 @@ pub enum RequestError {
/// Unable to load the content of an input source.
#[error("Error reading input '{0}': {1}")]
GetInputContent(InputSource, #[source] Box<ErrorKind>),

/// Unable to load an input source directly provided by the user.
#[error("Error reading user input '{0}': {1}")]
UserInputContent(InputSource, #[source] Box<ErrorKind>),
}

impl RequestError {
/// Get the underlying cause of this [`RequestError`].
#[must_use]
pub const fn error(&self) -> &ErrorKind {
match self {
Self::CreateRequestItem(_, _, e) | Self::GetInputContent(_, e) => e,
Self::CreateRequestItem(_, _, e)
| Self::GetInputContent(_, e)
| Self::UserInputContent(_, e) => e,
}
}

/// Convert this [`RequestError`] into its source error.
#[must_use]
pub fn into_error(self) -> ErrorKind {
match self {
Self::CreateRequestItem(_, _, e) | Self::GetInputContent(_, e) => *e,
Self::CreateRequestItem(_, _, e)
| Self::GetInputContent(_, e)
| Self::UserInputContent(_, e) => *e,
}
}

Expand All @@ -41,6 +49,7 @@ impl RequestError {
match self {
Self::CreateRequestItem(_, src, _) => src.clone().into(),
Self::GetInputContent(src, _) => src.clone(),
Self::UserInputContent(src, _) => src.clone(),
}
}
}
Expand Down
Loading