Botan 3.6.0
Crypto and TLS for C&
Botan::TPM2::Error Class Referencefinal

#include <tpm2_error.h>

Inheritance diagram for Botan::TPM2::Error:
Botan::Exception

Public Member Functions

TSS2_RC code () const
 
 Error (std::string_view location, TSS2_RC rc)
 
int error_code () const noexcept override
 
std::string error_message () const
 
ErrorType error_type () const noexcept override
 
const char * what () const noexcept override
 

Detailed Description

Definition at line 21 of file tpm2_error.h.

Constructor & Destructor Documentation

◆ Error()

Botan::TPM2::Error::Error ( std::string_view location,
TSS2_RC rc )

Definition at line 250 of file tpm2_error.cpp.

250 :
251 Exception(fmt("TPM2 Exception in {}: Code {} - {} ({})",
252 location,
253 raw_rc_to_string(get_raw_rc(rc)),
254 rc,
255 Tss2_RC_Decode(rc))),
256 m_rc(rc) {}
Exception(std::string_view msg)
Definition exceptn.cpp:71
TSS2_RC get_raw_rc(TSS2_RC rc)
std::string fmt(std::string_view format, const T &... args)
Definition fmt.h:53

Member Function Documentation

◆ code()

TSS2_RC Botan::TPM2::Error::code ( ) const
inline

Definition at line 27 of file tpm2_error.h.

27{ return m_rc; }

◆ error_code()

int Botan::TPM2::Error::error_code ( ) const
inlineoverridevirtualnoexcept

Return an error code associated with this exception, or otherwise 0.

The domain of this error varies depending on the source, for example on POSIX systems it might be errno, while on a Windows system it might be the result of GetLastError or WSAGetLastError.

Reimplemented from Botan::Exception.

Definition at line 29 of file tpm2_error.h.

29 {
30 // RC is uint32 but the maximum value is within int32 range as per tss2_common.h
31 return static_cast<int>(m_rc);
32 }

◆ error_message()

std::string Botan::TPM2::Error::error_message ( ) const

Definition at line 258 of file tpm2_error.cpp.

258 {
259 return Tss2_RC_Decode(m_rc);
260}

◆ error_type()

ErrorType Botan::TPM2::Error::error_type ( ) const
inlineoverridevirtualnoexcept

Return the "type" of error which occurred.

Reimplemented from Botan::Exception.

Definition at line 25 of file tpm2_error.h.

◆ what()

const char * Botan::Exception::what ( ) const
inlineoverridenoexceptinherited

Return a descriptive string which is hopefully comprehensible to a developer. It will likely not be useful for an end user.

The string has no particular format, and the content of exception messages may change from release to release. Thus the main use of this function is for logging or debugging.

Definition at line 93 of file exceptn.h.

93{ return m_msg.c_str(); }

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan_FFI::ffi_guard_thunk(), Botan::TLS::Callbacks::tls_ephemeral_key_agreement(), Botan::TLS::Callbacks::tls_kem_encapsulate(), and Botan::X509_Certificate::to_string().


The documentation for this class was generated from the following files: