1// SPDX-FileCopyrightText: 2022 HH Partners
2//
3// SPDX-License-Identifier: MIT
4
5//! Errors of the library.
6
7/// Custom error struct.
8#[derive(thiserror::Error, Debug)]
9pub enum SpdxExpressionError {
10 #[error("Parsing for expression `{0}` failed.")]
11 Parse(String),
12
13 #[error("Error parsing the SPDX Expression {0}.")]
14 Nom(String),
15}
16
17impl From<nom::Err<nom::error::Error<&str>>> for SpdxExpressionError {
18 fn from(err: nom::Err<nom::error::Error<&str>>) -> Self {
19 Self::Nom(err.to_string())
20 }
21}
22