Skip to main content

PrepareError

Enum PrepareError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

§entry_label: String

The entry’s id (or name when id is absent).

§signal_type: String

The unrecognized signal type string as it appeared in the compiled entry.

§

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.

Fields

§entry_label: String

The entry’s id (or name when id is absent).

§

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.

Fields

§entry_label: String

The entry’s id (or name when id is absent).

§

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

§entry_label: String

The entry’s id (or name when id is absent).

§signal_type: String

The signal type that requires a distribution ("histogram" or "summary").

§

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.

Fields

§version: u32

The rejected version value as carried by the compiled file.

Trait Implementations§

Source§

impl Debug for PrepareError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PrepareError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for PrepareError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<PrepareError> for CompileError

Source§

fn from(source: PrepareError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.