pub enum NpmError {
JsonParseError {
source: Error,
},
InvalidVersionSpecifier {
specifier: String,
message: String,
},
PackageNotFound {
package: String,
},
RegistryError {
package: String,
source: Box<dyn Error + Send + Sync>,
},
ApiResponseError {
package: String,
source: Error,
},
InvalidStructure {
message: String,
},
MissingField {
section: String,
field: String,
},
CacheError(String),
Io(Error),
Other(Box<dyn Error + Send + Sync>),
}Expand description
Errors specific to npm/JavaScript dependency handling.
These errors cover parsing package.json files, validating npm semver specifications, and communicating with the npm registry.
Variants§
JsonParseError
Failed to parse package.json
InvalidVersionSpecifier
Invalid npm semver version specifier
PackageNotFound
Package not found on npm registry
RegistryError
npm registry request failed
ApiResponseError
Failed to deserialize npm API response
InvalidStructure
Invalid package.json structure
MissingField
Missing required field in package.json
CacheError(String)
Cache error
Io(Error)
I/O error
Other(Box<dyn Error + Send + Sync>)
Generic error wrapper
Implementations§
Source§impl NpmError
impl NpmError
Sourcepub fn registry_error(
package: impl Into<String>,
error: impl Error + Send + Sync + 'static,
) -> Self
pub fn registry_error( package: impl Into<String>, error: impl Error + Send + Sync + 'static, ) -> Self
Create a registry error from any error type.
Sourcepub fn api_response_error(package: impl Into<String>, error: Error) -> Self
pub fn api_response_error(package: impl Into<String>, error: Error) -> Self
Create an API response error.
Sourcepub fn invalid_structure(message: impl Into<String>) -> Self
pub fn invalid_structure(message: impl Into<String>) -> Self
Create an invalid structure error.
Trait Implementations§
Source§impl Error for NpmError
impl Error for NpmError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for NpmError
impl !RefUnwindSafe for NpmError
impl Send for NpmError
impl Sync for NpmError
impl Unpin for NpmError
impl !UnwindSafe for NpmError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.