Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/tfexception.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class T_CORE_EXPORT TfException : public std::exception
TfException(const QString &message, const char *fileName = "", int lineNumber = 0) noexcept
: msg(message), file(fileName), line(lineNumber)
{
whatmsg = className().toLocal8Bit() + ": ";
whatmsg += message.toLocal8Bit();
whatmsg = message.toLocal8Bit();
if (lineNumber > 0) {
whatmsg += " [";
whatmsg += fileName;
Expand All @@ -31,7 +30,7 @@ class T_CORE_EXPORT TfException : public std::exception

virtual void raise() const { throw *this; }
virtual std::exception *clone() const { return new TfException(*this); }
virtual QString className() const { return QLatin1String("TfException"); }
virtual QString className() const { return QStringLiteral("TfException"); }
virtual const char *what() const noexcept override { return whatmsg.constData(); }

protected:
Expand All @@ -50,7 +49,7 @@ class T_CORE_EXPORT RuntimeException : public TfException

void raise() const override { throw *this; }
std::exception *clone() const override { return new RuntimeException(*this); }
QString className() const override { return QLatin1String("RuntimeException"); }
QString className() const override { return QStringLiteral("RuntimeException"); }
};


Expand All @@ -62,7 +61,7 @@ class T_CORE_EXPORT SecurityException : public TfException

void raise() const override { throw *this; }
std::exception *clone() const override { return new SecurityException(*this); }
QString className() const override { return QLatin1String("SecurityException"); }
QString className() const override { return QStringLiteral("SecurityException"); }
};


Expand All @@ -74,7 +73,7 @@ class T_CORE_EXPORT SqlException : public TfException

void raise() const override { throw *this; }
std::exception *clone() const override { return new SqlException(*this); }
QString className() const override { return QLatin1String("SqlException"); }
QString className() const override { return QStringLiteral("SqlException"); }
};


Expand All @@ -86,21 +85,22 @@ class T_CORE_EXPORT KvsException : public TfException

void raise() const override { throw *this; }
std::exception *clone() const override { return new KvsException(*this); }
QString className() const override { return QLatin1String("KvsException"); }
QString className() const override { return QStringLiteral("KvsException"); }
};


class T_CORE_EXPORT ClientErrorException : public TfException
{
public:
ClientErrorException(int statusCode, const char *fileName = "", int lineNumber = 0)
: TfException(QString("HTTP status code: %1").arg(statusCode), fileName, lineNumber),
: TfException(QStringLiteral("HTTP status code: %1").arg(statusCode), fileName, lineNumber),
code(statusCode) { }

int statusCode() const { return code; }

void raise() const override { throw *this; }
std::exception *clone() const override { return new ClientErrorException(*this); }
QString className() const override { return QLatin1String("ClientErrorException"); }
QString className() const override { return QStringLiteral("ClientErrorException"); }

private:
int code;
Expand All @@ -115,7 +115,7 @@ class T_CORE_EXPORT StandardException : public TfException

void raise() const override { throw *this; }
std::exception *clone() const override { return new StandardException(*this); }
QString className() const override { return QLatin1String("StandardException"); }
QString className() const override { return QStringLiteral("StandardException"); }
};

#endif // TFEXCEPTION_H