Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
badrequest.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2024 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#ifndef BADREQUEST_H
9#define BADREQUEST_H
10
11#include "abstractdata.h"
12#include "abstracterrorcodes.h"
13
14namespace QH{
15namespace PKG {
16
20struct ErrorData {
24 unsigned char code = 0;
28 QString msg;
29};
30
35{
36 QH_PACKAGE("BadRequest")
37public:
38
44 explicit BadRequest(unsigned char errocode = ErrorCodes::InvalidRequest, const QString & err = "");
45
50 explicit BadRequest(const ErrorData& data);
51 explicit BadRequest(const Package& package);
52
57 QString err() const;
58
63 void setErr(const QString &err);
64
65 // StreamBase interface
66 QDataStream &fromStream(QDataStream &stream) override;
67 QDataStream &toStream(QDataStream &stream) const override;
68
73 unsigned char errCode() const;
74
79 void setErrCode(unsigned char code);
80
81private:
82 QString _err;
83 unsigned char _errCode;
84
85};
86}
87}
88
89#endif // BADREQUEST_H
#define QH_PACKAGE(S)
QH_PACKAGE This macross prepare data to send and create a global id for package. For get global id us...
The AbstractData class is provide base functions for transport data by network For create you own pac...
The BadRequest class send response about error to client.
Definition badrequest.h:35
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition package.h:23
#define HEARTSHARED_EXPORT
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13
The ErrorData struct is simple structure for contains data of the error.
Definition badrequest.h:20
unsigned char code
code This is code of error. By Default this member equals EccorCodes::UnknownError.
Definition badrequest.h:24
QString msg
msg This is message of error.
Definition badrequest.h:28