More work on log upload error codes.

This commit is contained in:
lotodore
2012-12-22 20:56:00 +01:00
parent ae786702f6
commit d9f6bd88c2
2 changed files with 5 additions and 8 deletions
-1
View File
@@ -103,7 +103,6 @@ enum PlayerActionLog {
LOG_ACTION_JOIN // has joined the game
};
#define LOG_UPLOAD_ERROR_PREFIX "ERROR"
#define LOG_UPLOAD_ID_SIZE 40
enum LogUploadErrorCode {
+5 -7
View File
@@ -261,19 +261,17 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage)
QString id = returnMessage.trimmed();
if(id.length() == LOG_UPLOAD_ID_SIZE && !id.contains(LOG_UPLOAD_ERROR_PREFIX)) {
if(id.length() == LOG_UPLOAD_ID_SIZE && id.at(0) != '<') {
qDebug() << id << endl;
QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id));
} else {
qDebug() << returnMessage << endl;
QString serverMsg(tr("Processing of the log file on the web server failed.\nPlease verify that you are uploading a valid PokerTH log file."));
// if there is a readable message, display it.
if (returnMessage.startsWith(LOG_UPLOAD_ERROR_PREFIX)) {
// if there is an error code, display a corresponding message.
if (returnMessage.at(0).isDigit()) {
serverMsg += "\n" + tr("Failure reason: ");
QString errorCodeStr = returnMessage.mid(sizeof(LOG_UPLOAD_ERROR_PREFIX)).trimmed();
int errorCode = errorCodeStr.toInt();
switch (errorCode)
switch (returnMessage.toInt())
{
case LOG_UPLOAD_ERROR_NO_FILE :
serverMsg += tr("No file received.");
@@ -296,7 +294,7 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage)
case LOG_UPLOAD_ERROR_FILE_MOVE :
case LOG_UPLOAD_ERROR_INSERT_DB :
default :
serverMsg += tr("Internal error. Please try again later. ID: ") + errorCodeStr;
serverMsg += tr("Internal error. Please try again later. ID: ") + returnMessage;
break;
}
}