Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-error.h File Reference

The qx-error.h header file provides access to the Error interface. More...

#include "qx/core/qx_core_export.h"
#include <QHash>
#include <QMetaType>
#include <QTextStream>
#include "qx/core/qx-abstracterror.h"
Include dependency graph for qx-error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Qx::Error
 The Error class acts as an interface for an extensible variety of error objects. More...
 

Namespaces

namespace  Qx
 The Qx namespace is the main namespace through which all non-global functionality of the Qx library is accessed.
 

Macros

#define QX_DECLARE_ERROR_ADAPTATION(Adaptable, Adapter)
 

Functions

QX_CORE_EXPORT QTextStreamoperator<< (QTextStream &ts, const Qx::Error &e)
 

Macro Definition Documentation

◆ QX_DECLARE_ERROR_ADAPTATION

#define QX_DECLARE_ERROR_ADAPTATION ( Adaptable,
Adapter )
Value:
static_assert(Qx::error_adaptation<Adaptable, Adapter>, "Adapter must satisfy the 'error_adapter' concept " \
"and be constructable from Adaptable."); \
template<> \
struct QxErrorPrivate::adapter_registry<Adaptable> { typedef Adapter adapter; };
Specifies that two types form a Qx error adaptation.
Definition qx-abstracterror.h:159
Definition qx-error.h:19

This macro registers Adapter as an Error Adapter for the type Adaptable. Adaptable and Adapter together must satisfy the error_adaptation constraint.

Function Documentation

◆ operator<<()

QX_CORE_EXPORT QTextStream & operator<< ( QTextStream & ts,
const Qx::Error & e )

Writes the error e to the stream ts.

The error is written in a human-readable format, structured by its properties. A new line is always started after the error is written.

See also
postError().
ge.setValue(50);
ge.setCaption("Caption");
ge.setPrimary("Generic Error");
ge.setSecondary("There was an Error");
ge.setDetailed("- Issue 1\n- Issue2\n- Issue3");
ts << Qx::Error(ge);
// Prints:
/*
* (WARNING) 0x00000032 Caption
* Generic Error
* There was an Error
*
* Details:
* --------
* - Issue 1
* - Issue 2
* - Issue 3
*/
The Error class acts as an interface for an extensible variety of error objects.
Definition qx-error.h:38
The GenericError class is multi-purpose container for storing error information.
Definition qx-genericerror.h:14
GenericError & setCaption(const QString &caption)
Definition qx-genericerror.cpp:139
GenericError & setSeverity(Severity sv)
Definition qx-genericerror.cpp:119
GenericError & setSecondary(const QString &secondary)
Definition qx-genericerror.cpp:153
GenericError & setPrimary(const QString &primary)
Definition qx-genericerror.cpp:146
virtual QString deriveSecondary() const
Definition qx-abstracterror.cpp:124
QTextStream cout
Definition qx-iostream.h:13
@ Warning
Definition qx-global.h:12
QString text() const const
QSqlError::ErrorType type() const const
QString arg(Args &&... args) const const
The qx-error.h header file provides access to the Error interface.
#define QX_DECLARE_ERROR_ADAPTATION(Adaptable, Adapter)
Definition qx-error.h:132