• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

facet-rs / facet / 14697837564

28 Apr 2025 12:40AM UTC coverage: 57.737% (+0.08%) from 57.661%
14697837564

push

github

fasterthanlime
feat(facet-args): Expand error handling

50 of 67 new or added lines in 2 files covered. (74.63%)

7231 of 12524 relevant lines covered (57.74%)

75.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.67
/facet-args/src/error.rs
1
use facet_reflect::ReflectError;
2

3
/// Error deserializing the Arguments
4
pub struct ArgsError {
5
    /// Type of error
6
    pub kind: ArgsErrorKind,
7
}
8

9
impl ArgsError {
10
    /// Create a new error.
11
    pub fn new(kind: ArgsErrorKind) -> Self {
7✔
12
        Self { kind }
7✔
13
    }
7✔
14
    /// The message for this specific error.
15
    pub fn message(&self) -> String {
4✔
16
        match &self.kind {
4✔
NEW
17
            ArgsErrorKind::GenericReflect(reflect_error) => {
×
NEW
18
                format!("Error while reflecting type: {reflect_error}")
×
19
            }
20
            ArgsErrorKind::GenericArgsError(message) => format!("Args error: {message}"),
4✔
21
        }
22
    }
4✔
23
}
24

25
impl core::fmt::Display for ArgsError {
NEW
26
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
NEW
27
        write!(f, "{}", self.message())
×
NEW
28
    }
×
29
}
30

31
impl core::fmt::Debug for ArgsError {
NEW
32
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
NEW
33
        core::fmt::Display::fmt(self, f)
×
NEW
34
    }
×
35
}
36

37
impl core::error::Error for ArgsError {}
38

39
/// Type of error.
40
#[derive(Debug, PartialEq)]
41
pub enum ArgsErrorKind {
42
    /// Any error from facet
43
    GenericReflect(ReflectError),
44
    /// Parsing arguments error
45
    GenericArgsError(String),
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc