pub struct ConfigError { /* private fields */ }Expand description
A configuration value is invalid — wrong type, out of range, or otherwise unacceptable.
Corresponds to Java’s ConfigException, thrown throughout ConfigDef and
the *Config constructors. It lives in org.apache.kafka.common.config,
not common.errors, and has no entry in Errors, so it carries no
protocol code.
Java extends chain:
ConfigException -> KafkaException
Note it extends KafkaException directly, NOT IllegalArgumentException:
an invalid configuration is a Kafka error
(is_kafka_error is true),
unlike a java.lang.IllegalArgumentException.
Implementations§
Source§impl ConfigError
impl ConfigError
Sourcepub fn new(message: impl Into<String>) -> Self
pub fn new(message: impl Into<String>) -> Self
Create the error with the given message and no cause,
mirroring Java’s (String message) constructor.
This keeps the plain name under CLAUDE.md §2: the dominant Java
shape among the classes this macro declares is
(String message) + (String message, Throwable cause), whose
parameter-name intersection is {message} — matched exactly by
(String message).
Sourcepub fn with_source(message: impl Into<String>, source: Error) -> Self
pub fn with_source(message: impl Into<String>, source: Error) -> Self
Create the error with the given message and an underlying cause,
mirroring Java’s (String message, Throwable cause) constructor.
Suffixed with the one parameter beyond the {message}
intersection (CLAUDE.md §2) — see new.
Sourcepub fn with_default_message() -> Self
pub fn with_default_message() -> Self
Create the error with the default message for its error code,
mirroring Java’s Errors.exception().
Not a constructor overload, so CLAUDE.md §2’s suffixing does not
apply: it translates the Errors static factory, which fills in
Errors.message() and has no Java constructor counterpart.
Source§impl ConfigError
impl ConfigError
Sourcepub fn with_name_value(name: impl Display, value: impl Display) -> Self
pub fn with_name_value(name: impl Display, value: impl Display) -> Self
Create a config error naming the offending value and configuration key,
mirroring Java’s ConfigException(String name, Object value) (:32):
"Invalid value {value} for configuration {name}".
Sourcepub fn with_name_value_message(
name: impl Display,
value: impl Display,
message: impl Display,
) -> Self
pub fn with_name_value_message( name: impl Display, value: impl Display, message: impl Display, ) -> Self
Create a config error naming the value, key, and a detail message,
mirroring Java’s ConfigException(String name, Object value, String message)
(:36): "Invalid value {value} for configuration {name}: {message}".
Trait Implementations§
Source§impl Clone for ConfigError
impl Clone for ConfigError
Source§fn clone(&self) -> ConfigError
fn clone(&self) -> ConfigError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more