qTbot 0.2.107.d8fc923
qTbot is base back end library for your c++ Qt projects.
httpexception.cpp
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2024 QuasarApp.
3//# Distributed under the GPLv3 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#include "httpexception.h"
9
10namespace qTbot {
11
12HttpException::HttpException(QNetworkReply::NetworkError code,
13 const QByteArray &erroString) {
14
15 _code = code;
16
17 if (erroString.size()) {
18 _errText = erroString;
19 } else {
20
21 _errText = QByteArray("Http request finished with code: ").
22 append(QString::number(code).toLatin1());
23 }
24}
25
26const char *HttpException::what() const noexcept {
27 return _errText.constData();
28}
29
31 throw *this;
32}
33
34QException *HttpException::clone() const {
35 return new HttpException(QNetworkReply::NetworkError(0),
36 _errText);
37}
38
39QNetworkReply::NetworkError HttpException::code() const {
40 return _code;
41}
42}
The HttpException class is base exaption that will raise on all errors of the HTTP protocol,...
QException * clone() const override
const char * what() const noexcept override
void raise() const override
HttpException(QNetworkReply::NetworkError code, const QByteArray &erroString={})
QNetworkReply::NetworkError code() const