stellar_class/
error.rs

1use thiserror::Error;
2
3/// Error types.
4#[derive(Error, Debug, PartialEq)]
5pub enum Error {
6    /// The input classification string contains non-ASCII characters.
7    #[error("Invalid class string: not all chars are ascii")]
8    InvalidStringNonAscii,
9
10    /// The input classification string is too short.
11    /// A valid classification must have at least 3 characters (e.g., `O1V`).
12    #[error("Invalid class string: must contain at least 3 chars")]
13    InvalidStringTooShort,
14
15    /// The subtype part of the classification could is invalid.
16    ///
17    /// Subtypes must be a valid float between 0.0 and 9.9 (e.g. `1`, `0.5`),
18    /// and do not include redundant zeros or dots.
19    #[error("Invalid subtype")]
20    InvalidSubtype,
21
22    /// The spectral type letter is not recognized.
23    ///
24    /// Valid spectral types are O, B, A, F, G, K, M (uppercase).
25    #[error("Invalid spectral type")]
26    InvalidSpectralType,
27
28    /// The luminosity class is not supported or recognized.
29    ///
30    /// Standard classes like `Ia`, `III`, `V` are supported.
31    /// Non-standard formats are not supported yet.
32    #[error("Unsupported luminosity class")]
33    InvalidLuminosityClass,
34}