Skip to content

Commit

Permalink
box
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Dec 12, 2024
1 parent d7feb02 commit c6dd811
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ url = { version = "2.3.1" }
import_map = { version = "0.21.0", features = ["ext"], optional = true }
thiserror = "2"
deno_error = { version = "0.5.2", features = ["url"] }
boxed_error = "0.2.3"
deno_semver = { version = "0.6.0", optional = true }
deno_package_json = { version = "0.2.1", optional = true }
deno_path_util = "0.2.2"
Expand Down
10 changes: 7 additions & 3 deletions src/deno_json/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright 2018-2024 the Deno authors. MIT license.

use boxed_error::Boxed;
use deno_error::JsError;
use deno_error::JsErrorClass;
use deno_path_util::url_from_file_path;
Expand Down Expand Up @@ -48,8 +49,11 @@ pub struct LintRulesConfig {
pub exclude: Option<Vec<String>>,
}

#[derive(Debug, JsError, Boxed)]
pub struct IntoResolvedError(pub Box<IntoResolvedErrorKind>);

#[derive(Debug, Error, JsError)]
pub enum IntoResolvedError {
pub enum IntoResolvedErrorKind {
#[class(inherit)]
#[error(transparent)]
UrlToFilePath(#[from] UrlToFilePathError),
Expand Down Expand Up @@ -82,15 +86,15 @@ impl SerializedFilesConfig {
&config_dir,
&i,
)
.map_err(IntoResolvedError::InvalidInclude)?,
.map_err(IntoResolvedErrorKind::InvalidInclude)?,
),
None => None,
},
exclude: PathOrPatternSet::from_exclude_relative_path_or_patterns(
&config_dir,
&self.exclude,
)
.map_err(IntoResolvedError::InvalidExclude)?,
.map_err(IntoResolvedErrorKind::InvalidExclude)?,
})
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/workspace/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum WorkspaceResolverCreateError {
referrer: Url,
#[source]
#[inherit]
source: ConfigFileError,
source: Box<ConfigFileError>,
},
#[class(inherit)]
#[error(transparent)]
Expand Down Expand Up @@ -188,10 +188,9 @@ impl MappedResolutionError {
SpecifierError::InvalidUrl(_) => false,
SpecifierError::ImportPrefixMissing { .. } => true,
},
MappedResolutionError::ImportMap(err) => match **err {
ImportMapErrorKind::UnmappedBareSpecifier(_, _) => true,
_ => false,
},
MappedResolutionError::ImportMap(err) => {
matches!(**err, ImportMapErrorKind::UnmappedBareSpecifier(_, _))
}
MappedResolutionError::Workspace(_) => false,
}
}
Expand Down Expand Up @@ -280,7 +279,7 @@ impl WorkspaceResolver {
.to_import_map_value(read_file)
.map_err(|source| WorkspaceResolverCreateError::ImportMapFetch {
referrer: deno_json.specifier.clone(),
source,
source: Box::new(source),
})?
.unwrap_or_else(|| {
(
Expand Down

0 comments on commit c6dd811

Please sign in to comment.