39 return "invalid metric name";
41 return "invalid label name";
43 return "empty help text";
45 return "invalid histogram buckets";
47 return "invalid summary quantiles";
49 return "empty state set";
51 return "metric registration failed";
53 return "unknown error";
73 error_(std::move(
error)) {}
Thrown by the throwing Registry factories when a spec fails validation.
Definition error.hpp:69
Exception(Error error)
Definition error.hpp:71
const Error & error() const noexcept
The structured error that triggered this exception.
Definition error.hpp:76
Definition adapter.hpp:24
ErrorCode
Why a metric definition or registration was rejected.
Definition error.hpp:25
@ EmptyStateSet
A state set was declared with no states.
@ InvalidLabelName
A label name is invalid or uses the reserved __ prefix.
@ InvalidMetricName
Name violates [a-zA-Z_][a-zA-Z0-9_]*.
@ EmptyHelp
Help text is required but was empty.
@ RegistrationFailed
The backend refused to register the metric.
@ InvalidQuantiles
Summary quantiles fall outside the open interval (0, 1).
@ InvalidBuckets
Histogram buckets are unsorted, empty, or non-finite.
constexpr std::string_view to_string(const ErrorCode code) noexcept
Human-readable spelling of an ErrorCode.
Definition error.hpp:36
std::expected< T, Error > expected
std::expected<T, Error> — the result type of the Registry::try_* family.
Definition error.hpp:66
A validation failure: a machine code plus a human message.
Definition error.hpp:57
std::string message
Context (e.g. the offending name).
Definition error.hpp:59
ErrorCode code
Machine-readable reason.
Definition error.hpp:58
bool operator==(const Error &) const =default