npm_parser/
lib.rs

1#![deny(unknown_lints)]
2#![deny(renamed_and_removed_lints)]
3#![forbid(unsafe_code)]
4#![deny(deprecated)]
5#![forbid(private_interfaces)]
6#![forbid(private_bounds)]
7#![forbid(non_fmt_panics)]
8#![deny(unreachable_code)]
9#![deny(unreachable_patterns)]
10#![forbid(unused_doc_comments)]
11#![forbid(unused_must_use)]
12#![deny(while_true)]
13#![deny(unused_parens)]
14#![deny(redundant_semicolons)]
15#![deny(non_ascii_idents)]
16#![deny(confusable_idents)]
17#![warn(missing_docs)]
18#![warn(clippy::missing_docs_in_private_items)]
19#![warn(clippy::cargo_common_metadata)]
20#![warn(rustdoc::missing_crate_level_docs)]
21#![deny(rustdoc::broken_intra_doc_links)]
22#![warn(missing_debug_implementations)]
23#![deny(clippy::mod_module_files)]
24#![doc = include_str!("../README.md")]
25
26pub mod audit;
27pub mod outdated;
28
29use thiserror::Error;
30
31/// Error type for npm_parser
32#[derive(Debug, Error)]
33pub enum Error {
34    /// This means something went wrong when we were parsing the JSON output
35    /// of the program
36    #[error("Error parsing JSON: {0}")]
37    SerdeJsonError(#[from] serde_json::Error),
38    /// This is a wrapped serde_json error which provides a path to the location
39    /// where the error occurred
40    #[error("Error parsing JSON (with path): {0}")]
41    SerdePathError(#[from] serde_path_to_error::Error<serde_json::Error>),
42    /// This means the output of the program contained some string that was not
43    /// valid UTF-8
44    #[error("Error interpreting program output as UTF-8: {0}")]
45    Utf8Error(#[from] std::str::Utf8Error),
46    /// This is likely to be an error when executing the program using std::process
47    #[error("I/O Error: {0}")]
48    StdIoError(#[from] std::io::Error),
49}