More work on log upload error codes.
This commit is contained in:
@@ -103,7 +103,6 @@ enum PlayerActionLog {
|
|||||||
LOG_ACTION_JOIN // has joined the game
|
LOG_ACTION_JOIN // has joined the game
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LOG_UPLOAD_ERROR_PREFIX "ERROR"
|
|
||||||
#define LOG_UPLOAD_ID_SIZE 40
|
#define LOG_UPLOAD_ID_SIZE 40
|
||||||
|
|
||||||
enum LogUploadErrorCode {
|
enum LogUploadErrorCode {
|
||||||
|
|||||||
@@ -261,19 +261,17 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage)
|
|||||||
|
|
||||||
QString id = returnMessage.trimmed();
|
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;
|
qDebug() << id << endl;
|
||||||
QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id));
|
QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id));
|
||||||
} else {
|
} else {
|
||||||
qDebug() << returnMessage << endl;
|
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."));
|
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 there is an error code, display a corresponding message.
|
||||||
if (returnMessage.startsWith(LOG_UPLOAD_ERROR_PREFIX)) {
|
if (returnMessage.at(0).isDigit()) {
|
||||||
serverMsg += "\n" + tr("Failure reason: ");
|
serverMsg += "\n" + tr("Failure reason: ");
|
||||||
QString errorCodeStr = returnMessage.mid(sizeof(LOG_UPLOAD_ERROR_PREFIX)).trimmed();
|
switch (returnMessage.toInt())
|
||||||
int errorCode = errorCodeStr.toInt();
|
|
||||||
switch (errorCode)
|
|
||||||
{
|
{
|
||||||
case LOG_UPLOAD_ERROR_NO_FILE :
|
case LOG_UPLOAD_ERROR_NO_FILE :
|
||||||
serverMsg += tr("No file received.");
|
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_FILE_MOVE :
|
||||||
case LOG_UPLOAD_ERROR_INSERT_DB :
|
case LOG_UPLOAD_ERROR_INSERT_DB :
|
||||||
default :
|
default :
|
||||||
serverMsg += tr("Internal error. Please try again later. ID: ") + errorCodeStr;
|
serverMsg += tr("Internal error. Please try again later. ID: ") + returnMessage;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user