Skip to main content

RecordDeserializationError

Struct RecordDeserializationError 

Source
pub struct RecordDeserializationError { /* private fields */ }
Expand description

This error is raised for any error that occurs while deserializing records received by the consumer using the configured Deserializer.

§Translation notes

No protocol code.

Implementations§

Source§

impl RecordDeserializationError

Source

pub fn new( origin: DeserializationErrorOrigin, partition: TopicPartition, offset: i64, timestamp: i64, timestamp_type: TimestampType, key_buffer: Option<Vec<u8>>, value_buffer: Option<Vec<u8>>, headers: Option<RecordHeaders>, message: impl Into<String>, ) -> Self

Creates a deserialization error with the full context of the offending record; the cause is attached by Self::with_source.

§Arguments
  • origin - which side of the record (key or value) failed to deserialize
  • partition - the partition of the record
  • offset - the offset of the record
  • timestamp - the timestamp of the record
  • timestamp_type - the timestamp type of the record
  • key_buffer - the raw key bytes, None for a null key
  • value_buffer - the raw value bytes, None for a null value
  • headers - the record headers
  • message - the error’s message
Source

pub fn origin(&self) -> DeserializationErrorOrigin

Returns which side of the record (key or value) failed to deserialize.

Source

pub fn topic_partition(&self) -> &TopicPartition

Returns the partition of the offending record.

Source

pub fn offset(&self) -> i64

Returns the offset of the offending record.

Source

pub fn timestamp(&self) -> i64

Returns the timestamp of the offending record.

Source

pub fn timestamp_type(&self) -> TimestampType

Returns the timestamp type of the offending record.

Source

pub fn key_buffer(&self) -> Option<&[u8]>

Returns the raw key bytes, or None if absent.

Source

pub fn value_buffer(&self) -> Option<&[u8]>

Returns the raw value bytes, or None if absent.

Source

pub fn headers(&self) -> Option<&RecordHeaders>

Returns the record headers, or None if absent.

Source

pub fn with_source(self, source: Error) -> Self

Attaches the error that caused this deserialization failure.

§Arguments
  • source - the error’s cause
§Returns

this error, with its cause set

Source

pub fn message(&self) -> &str

Returns the error message: Java’s getMessage().

Source

pub fn source(&self) -> Option<&Error>

Returns the underlying cause, if any: Java’s getCause().

Trait Implementations§

Source§

impl Clone for RecordDeserializationError

Source§

fn clone(&self) -> RecordDeserializationError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RecordDeserializationError

Source§

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

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

impl Display for RecordDeserializationError

Source§

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

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

impl Error for RecordDeserializationError

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V