source: SMSSender/lib/datatypes/src/exceptions/eloginaccountloginexception.cpp @ 194:106adb6139a4

Last change on this file since 194:106adb6139a4 was 194:106adb6139a4, checked in by Sämy Zehnder <saemy.zehnder@…>, 7 years ago
  • Updated the copyright lines to the year 2012.
File size: 1.9 KB
Line 
1/*
2 smssender - A frontend for fast and easy SMS sending over different gateways.
3 Copyright (C) 2007-2012, gorrión. See http://smssender.gorrion.ch
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
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.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18#include "eloginaccountloginexception.h"
19
20#include <QMetaType>
21
22namespace LoginAccount {
23
24ELoginException::ELoginException(const QString& msg)
25    : EException(msg)
26    , purpose_(Other)
27{
28}
29ELoginException::ELoginException(const Purpose& purpose)
30    : EException("")
31    , purpose_(purpose)
32{
33}
34ELoginException::ELoginException(const ELoginException& other)
35    : EException(other)
36{
37    this->purpose_ = other.purpose_;
38}
39
40void ELoginException::raise() {
41    throw *this;
42}
43ELoginException* ELoginException::createClonedInstance() const throw() {
44    return new ELoginException(*this);
45}
46
47ELoginException::Purpose ELoginException::purpose() const throw() {
48    return purpose_;
49}
50
51QString ELoginException::toString() const throw() {
52    QString msg = QObject::tr("Login failed: ");
53    switch (purpose()) {
54        case RequestError:
55            return msg + QObject::tr("Request error");
56        case InvalidLoginData:
57            return msg + QObject::tr("Your login data might be wrong");
58        case Other:
59            return msg + EException::unchainedWhat();
60        case Unknown:
61        default:
62            return msg + QObject::tr("Unknown error");
63    }
64}
65
66
67} // namespace LoginAccount
Note: See TracBrowser for help on using the repository browser.