npm_parser/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod audit;
4pub mod outdated;
5
6use thiserror::Error;
7
8/// Error type for npm_parser
9#[derive(Debug, Error)]
10pub enum Error {
11    /// This means something went wrong when we were parsing the JSON output
12    /// of the program
13    #[error("Error parsing JSON: {0}")]
14    SerdeJsonError(#[from] serde_json::Error),
15    /// This is a wrapped serde_json error which provides a path to the location
16    /// where the error occurred
17    #[error("Error parsing JSON (with path): {0}")]
18    SerdePathError(#[from] serde_path_to_error::Error<serde_json::Error>),
19    /// This means the output of the program contained some string that was not
20    /// valid UTF-8
21    #[error("Error interpreting program output as UTF-8: {0}")]
22    Utf8Error(#[from] std::str::Utf8Error),
23    /// This is likely to be an error when executing the program using std::process
24    #[error("I/O Error: {0}")]
25    StdIoError(#[from] std::io::Error),
26}