ephemeris_documents/error/
value.rs1use std::fmt;
4
5use crate::format::Format;
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum Feature {
10 Null,
12 LargeInteger,
14 LiteralString,
16 Comment,
18 InlineComment,
20 DottedTable,
22}
23
24impl fmt::Display for Feature {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 f.write_str(match self {
27 Self::Null => "null values",
28 Self::LargeInteger => "integers above the signed 64-bit range",
29 Self::LiteralString => "literal strings",
30 Self::Comment => "comments",
31 Self::InlineComment => "comments in inline tables",
32 Self::DottedTable => "dotted tables",
33 })
34 }
35}
36
37#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
39pub enum ValueError {
40 #[error("value contains a non-finite number, which cannot be rendered")]
42 NonFinite,
43 #[error("value contains an integer outside the 64-bit range")]
45 IntegerOutOfRange,
46 #[error("value contains a kind of value that documents cannot represent")]
49 UnsupportedKind,
50 #[error("value is not a string")]
52 NotString,
53 #[error("{format} does not support {feature}")]
55 Unsupported {
56 format: Format,
58 feature: Feature,
60 },
61}