Coverage Report

Created: 2026-09-06 07:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata8/rust/src/detect/error.rs
Line
Count
Source
1
/* Copyright (C) 2022 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17
18
use nom7::error::{ErrorKind, ParseError};
19
20
/// Custom rule parse errors.
21
///
22
/// Implemented based on the Nom example for implementing custom errors.
23
/// The string is an error message provided by the parsing logic, e.g.,
24
///      Incorrect usage because of "x", "y" and "z"
25
#[derive(Debug, PartialEq, Eq)]
26
pub enum RuleParseError<I> {
27
    InvalidByteMath(String),
28
    InvalidIPRep(String),
29
    InvalidTransformBase64(String),
30
    InvalidByteExtract(String),
31
    InvalidEntropy(String),
32
33
    Nom(I, ErrorKind),
34
}
35
impl<I> ParseError<I> for RuleParseError<I> {
36
14.6k
    fn from_error_kind(input: I, kind: ErrorKind) -> Self {
37
14.6k
        RuleParseError::Nom(input, kind)
38
14.6k
    }
39
40
0
    fn append(_: I, _: ErrorKind, other: Self) -> Self {
41
0
        other
42
0
    }
43
}