Sync translations from Transifex and run lupdate
[qBittorrent.git] / src / base / http / httperror.cpp
blob7f66fb627f0ad1e09e9325957ef38926a53f690f
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * In addition, as a special exception, the copyright holders give permission to
20 * link this program with the OpenSSL project's "OpenSSL" library (or with
21 * modified versions of it that use the same license as the "OpenSSL" library),
22 * and distribute the linked executables. You must obey the GNU General Public
23 * License in all respects for all of the code used other than "OpenSSL". If you
24 * modify file(s), you may extend this exception to your version of the file(s),
25 * but you are not obligated to do so. If you do not wish to do so, delete this
26 * exception statement from your version.
29 #include "httperror.h"
31 HTTPError::HTTPError(const int statusCode, const QString &statusText, const QString &message)
32 : RuntimeError {message}
33 , m_statusCode {statusCode}
34 , m_statusText {statusText}
38 int HTTPError::statusCode() const
40 return m_statusCode;
43 QString HTTPError::statusText() const
45 return m_statusText;
48 BadRequestHTTPError::BadRequestHTTPError(const QString &message)
49 : HTTPError(400, QLatin1String("Bad Request"), message)
53 UnauthorizedHTTPError::UnauthorizedHTTPError(const QString &message)
54 : HTTPError(401, QLatin1String("Unauthorized"), message)
58 ForbiddenHTTPError::ForbiddenHTTPError(const QString &message)
59 : HTTPError(403, QLatin1String("Forbidden"), message)
63 NotFoundHTTPError::NotFoundHTTPError(const QString &message)
64 : HTTPError(404, QLatin1String("Not Found"), message)
68 MethodNotAllowedHTTPError::MethodNotAllowedHTTPError(const QString &message)
69 : HTTPError(405, QLatin1String("Method Not Allowed"), message)
73 ConflictHTTPError::ConflictHTTPError(const QString &message)
74 : HTTPError(409, QLatin1String("Conflict"), message)
78 UnsupportedMediaTypeHTTPError::UnsupportedMediaTypeHTTPError(const QString &message)
79 : HTTPError(415, QLatin1String("Unsupported Media Type"), message)
83 InternalServerErrorHTTPError::InternalServerErrorHTTPError(const QString &message)
84 : HTTPError(500, QLatin1String("Internal Server Error"), message)