Qx v0.5.8
Qt Extensions Library
|
The SystemError class encapsulates system generated errors as an Qx::Error interface compatible object. More...
#include <qx/core/qx-systemerror.h>
Public Types | |
enum | OriginalFormat { Invalid , Hresult , NtStatus , Errno } |
Public Member Functions | |
SystemError () | |
QString | actionError () const |
QString | cause () const |
bool | isValid () const |
OriginalFormat | originalFormat () const |
quint32 | value () const |
Public Member Functions inherited from Qx::AbstractError<"Qx::SystemError", 2 > | |
operator bool () const | |
bool | operator!= (const AbstractError &other) const=default |
bool | operator== (const AbstractError &other) const=default |
Static Public Member Functions | |
static SystemError | fromErrno (int err, QString aError="System Error") |
static SystemError | fromHresult (HRESULT res, QString aError=u"System Error"_s) |
static SystemError | fromNtStatus (NTSTATUS res, QString aError=u"System Error"_s) |
Additional Inherited Members | |
Static Public Attributes inherited from Qx::AbstractError<"Qx::SystemError", 2 > | |
static constexpr quint16 | TYPE_CODE |
static constexpr QLatin1StringView | TYPE_NAME |
Protected Member Functions inherited from Qx::IError | |
IError ()=default | |
virtual QString | deriveCaption () const |
virtual QString | deriveDetails () const |
bool | operator!= (const IError &other) const =default |
bool | operator== (const IError &other) const =default |
Instances of this class correspond to a specific type of system error that is operating system dependent. Factory methods for each are available for each type on its corresponding system.
This enum represents the original error format of a given SystemError.
Enumerator | |
---|---|
Invalid | Used only for an invalid SystemError. |
Hresult | Windows HRESULT. |
NtStatus | Windows NTSTATUS. |
Errno | POSIX errno. |
Qx::SystemError::SystemError | ( | ) |
Constructs an invalid system error.
QString Qx::SystemError::actionError | ( | ) | const |
Returns the system activity that preceded the error.
QString Qx::SystemError::cause | ( | ) | const |
Returns the cause of the error. Usually, this a system dependent string representation of the error's code.
|
static |
Returns a system error based on the errno value err and with the action error aError.
The error's value is set directly to the value of err, while it's cause() will contain a string representation of the value.
|
static |
Returns a system error based on the HRESULT res and with the action error aError.
The error's value is set directly to the value of res, while it's cause() will contain a string representation of the value.
|
static |
Returns a system error based on the NTSTATUS res and with the action error aError.
The error's value is set directly to the value of res, while it's cause() will contain a string representation of the value.
bool Qx::SystemError::isValid | ( | ) | const |
Returns true
if the system error value is greater than 0
; otherwise, returns false
.
SystemError::OriginalFormat Qx::SystemError::originalFormat | ( | ) | const |
Returns the original format of the system error, which when known can be used to further dissect the error's value for more system specific error information.
quint32 Qx::SystemError::value | ( | ) | const |
Returns the original value of the system error.
The value of this code is system dependent and varies from facility to facility.