Enum hdbconnect_impl::HdbError
source · #[non_exhaustive]pub enum HdbError {
Show 18 variants
Deserialization {
source: DeserializationError,
},
Serialization {
source: SerializationError,
},
Cesu8,
Cesu8AsBytes {
bytes: Vec<u8>,
},
ConnParams {
source: Box<dyn Error + Send + Sync + 'static>,
},
DbError {
source: ServerError,
},
Decompression {
source: DecompressError,
},
TlsServerName,
TlsProtocol {
source: Error,
},
Evaluation(&'static str),
ExecutionResults(Vec<ExecutionResult>),
Impl(&'static str),
ImplDetailed(String),
Poison,
SessionClosingTransactionError,
Io {
source: Error,
},
Usage(&'static str),
UsageDetailed(String),
}Expand description
A list specifying categories of HdbError.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Deserialization
Fields
source: DeserializationErrorThe causing Error.
Deserialization of a ResultSet, a Row, a single HdbValue,
or an OutputParameter failed (methods try_into()).
Serialization
Fields
source: SerializationErrorThe causing Error.
Serialization of a ParameterDescriptor or a ParameterRow failed.
Cesu8
Some error occured while decoding CESU-8. This indicates a server issue!
Cesu8AsBytes
Decoding CESU-8 failed, original bytes are available.
ConnParams
Erroneous Connection Parameters, e.g. from a malformed connection URL.
DbError
Fields
source: ServerErrorThe causing Error.
Database server responded with an error;
the contained ServerError describes the conrete reason.
Decompression
Fields
source: DecompressErrorThe causing Error.
Decompression
TlsServerName
TLS set up failed because the server name was not valid.
TlsProtocol
TLS protocol error.
Evaluation(&'static str)
Error occured while evaluating an HdbResponse or an HdbReturnValue.
ExecutionResults(Vec<ExecutionResult>)
Database server responded with at least one error.
Impl(&'static str)
Implementation error.
ImplDetailed(String)
Implementation error.
Poison
Error occured in thread synchronization.
SessionClosingTransactionError
An error occurred on the server that requires the session to be terminated.
Io
Error occured in communication with the database.
Usage(&'static str)
Error caused by wrong usage.
UsageDetailed(String)
Error caused by wrong usage.
Implementations§
source§impl HdbError
impl HdbError
sourcepub fn server_error(&self) -> Option<&ServerError>
pub fn server_error(&self) -> Option<&ServerError>
Returns the contained ServerError, if any.
This method helps in case you need programmatic access to e.g. the error code.
Example:
if let Err(hdberror) = hdb_result {
if let Some(server_error) = hdberror.server_error() {
let sys_m_error_code: (i32, String, String) = connection
.query(&format!(
"select * from SYS.M_ERROR_CODES where code = {}",
server_error.code()
))?.try_into()?;
println!("sys_m_error_code: {:?}", sys_m_error_code);
}
}