#[non_exhaustive]pub enum PrepareError {
UnknownSignalType {
entry_label: String,
signal_type: String,
},
MissingGenerator {
entry_label: String,
},
MissingLogGenerator {
entry_label: String,
},
MissingDistribution {
entry_label: String,
signal_type: String,
},
UnsupportedVersion {
version: u32,
},
}Expand description
Errors produced by prepare.
Every variant carries enough context to identify the offending
CompiledEntry — either its user-provided id or, when the id is
absent, its name. Preferring id matches the convention used by
CompileAfterError,
so diagnostics chain cleanly when both phases need to report on the same
entry.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnknownSignalType
The entry’s signal_type was not one of the four recognized variants
("metrics", "logs", "histogram", "summary").
The parser already rejects unknown signal types, but this variant
keeps the translator self-contained: callers that construct a
CompiledFile in code without going through
parse still get a proper error
instead of a match panic.
Fields
MissingGenerator
A metrics entry had no generator field set.
signal_type: metrics is the only variant that reads generator
from the compiled entry. When the YAML path is used the parser
rejects a metrics entry missing generator at parse-time; reaching
this variant therefore implies the CompiledFile was built in
code rather than through parse.
MissingLogGenerator
A logs entry had no log_generator field set.
signal_type: logs is the only variant that reads log_generator
from the compiled entry. When the YAML path is used the parser
rejects a logs entry missing log_generator at parse-time;
reaching this variant therefore implies the CompiledFile was
built in code rather than through
parse.
MissingDistribution
A histogram or summary entry had no distribution field set.
signal_type: histogram and signal_type: summary both read
distribution from the compiled entry. When the YAML path is used
the parser rejects either shape missing distribution at
parse-time; reaching this variant therefore implies the
CompiledFile was built in code rather than through
parse.
Fields
UnsupportedVersion
The compiled file’s version was not 2.
Defense-in-depth against programmatic callers that construct a
CompiledFile in code with a non-v2 version. Going through
parse already pins the version
at parse-time, so this variant is unreachable via the YAML path.
Trait Implementations§
Source§impl Debug for PrepareError
impl Debug for PrepareError
Source§impl Display for PrepareError
impl Display for PrepareError
Source§impl Error for PrepareError
impl Error for PrepareError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()