#[non_exhaustive]pub enum Error {
Show 17 variants
Io {
file: String,
message: String,
},
Json {
file: String,
message: String,
},
Yaml {
file: String,
message: String,
},
Malformed {
file: String,
path: String,
reason: String,
},
UnknownTheme {
name: String,
},
ExtendsCycle {
chain: Vec<String>,
},
UnknownAlias {
path: String,
target: String,
},
AliasCycle {
chain: Vec<String>,
},
MissingType {
path: String,
},
TypeMismatch {
path: String,
expected: String,
found: String,
},
InvalidValue {
path: String,
ty: String,
reason: String,
},
InvalidModifier {
path: String,
reason: String,
},
Missing {
path: String,
},
UnknownOverride {
path: String,
},
UnknownAccent {
name: String,
},
UnknownBase {
path: String,
base: String,
},
BasedOnCycle {
chain: Vec<String>,
},
}Expand description
A problem in a token file or met while resolving a theme.
Reading a file returns one as an error. Resolving a theme never fails:
it reports its problems in crate::ResolvedTokens::problems and
falls back where it must.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
The file cannot be read from disk.
Json
The file is not valid JSON.
Yaml
The file is not valid YAML, or holds a value YAML misreads (an
unquoted #colour or {alias}).
Malformed
The file is valid JSON but not a token file.
UnknownTheme
A theme named by a spec or by $extends is not known.
ExtendsCycle
Themes extend each other in a circle.
UnknownAlias
An alias names a token that does not exist.
AliasCycle
Aliases lead back to where they started.
MissingType
A token has no $type, on itself, its groups or what it aliases.
TypeMismatch
A token has another type than expected (by its alias target, or by the contract).
InvalidValue
A value that cannot be read as its type.
InvalidModifier
A modifier in a token’s $extensions that cannot apply (an alpha
outside 0 to 1, or on a token that is not a colour).
Missing
A token of the contract is not given by the theme.
UnknownOverride
An override names a token the theme does not have.
UnknownAccent
An accent names no usable colour scale.
UnknownBase
A component is based on a component no token names
(<component>.based-on): it keeps its own tokens only.
BasedOnCycle
Components are based on each other in a circle: each keeps its own tokens only.