BoxError

Struct BoxError 

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

Structured info about an error which can happen as a result of an internal API or a remote procedure call.

Can also be used in user code to return structured error info from stored procedures.

Implementations§

Source§

impl BoxError

Source

pub fn new(code: impl Into<u32>, message: impl Into<String>) -> Self

Construct an error object with given error code and message. The resulting error will have file & line fields set from the caller’s location.

Use Self::with_location to override error location.

Source

pub fn with_location( code: impl Into<u32>, message: impl Into<String>, file: impl Into<String>, line: u32, ) -> Self

Construct an error object with given error code and message and source location.

Use Self::new to use the caller’s location.

Source

pub fn maybe_last() -> Result<(), Self>

Tries to get the information about the last API call error. If error was not set returns Ok(())

Source

pub unsafe fn from_ptr(error_ptr: NonNull<BoxError>) -> Self

Create a BoxError from a poniter to the underlying struct.

Use Self::maybe_last to automatically get the last error set by tarantool.

§Safety

The pointer must point to a valid struct of type BoxError.

Also must only be called from the tx thread.

Source

pub fn last() -> Self

Get the information about the last API call error.

Source

pub fn set_last(&self)

Set self as the last API call error. Useful when returning errors from stored prcoedures.

Source

pub fn error_code(&self) -> u32

Return IPROTO error code

Source

pub fn error_type(&self) -> &str

Return the error type, e.g. “ClientError”, “SocketError”, etc.

Source

pub fn message(&self) -> &str

Return the error message

Source

pub fn file(&self) -> Option<&str>

Return the name of the source file where the error was created, if it’s available.

Source

pub fn line(&self) -> Option<u32>

Return the source line number where the error was created, if it’s available.

Source

pub fn errno(&self) -> Option<u32>

Return the system errno value of the cause of this error, if it’s available.

You can use std::io::Error::from_raw_os_error to get more details for the returned error code.

Source

pub fn cause(&self) -> Option<&Self>

Return the error which caused this one, if it’s available.

Source

pub fn fields(&self) -> &HashMap<Box<str>, Value>

Return the map of additional fields.

Trait Implementations§

Source§

impl Clone for BoxError

Source§

fn clone(&self) -> BoxError

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 BoxError

Source§

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

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

impl Default for BoxError

Source§

fn default() -> BoxError

Returns the “default value” for a type. Read more
Source§

impl Display for BoxError

Source§

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

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

impl From<BoxError> for Error

Source§

fn from(error: BoxError) -> Self

Converts to this type from the input type.
Source§

impl IntoBoxError for BoxError

Source§

fn set_last_error(self)

Set self as the current fiber’s last error.
Source§

fn into_box_error(self) -> BoxError

Convert self to BoxError.
Source§

fn error_code(&self) -> u32

Get the error code which would be used for the corresponding BoxError. 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> IntoClones<(T,)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.