You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Code/Tools/News/NewsShared/ErrorCodes.h

52 lines
1.3 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <QString>
namespace News
{
enum class ErrorCode : int
{
None,
OutOfSync,
ManifestDownloadFail,
FailedToSync,
AlreadySyncing,
FailedToParseManifest,
MissingArticle,
NoEndpoint,
ManifestUploadFail,
S3Fail
};
inline extern const char* GetErrorMessage(ErrorCode errorCode)
{
static const char* errors[]
{
"",
"Your manifest is out of sync. Reopen the same endpoint and sync to resolve the conflict and try again.",
"Failed to download resource manifest",
"Failed to sync resources",
"Sync is already running",
"Failed to parse resource manifest",
"Could not find article, try syncing again",
"Missing or incorrect endpoint selected",
"Failed to upload resource manifest",
"Failed to init S3 connection"
};
int errorCount = sizeof errors / sizeof errors[0];
int typeIndex = static_cast<int>(errorCode);
if (typeIndex < 0 || typeIndex >= errorCount)
{
return "Invalid error code";
}
return errors[typeIndex];
}
} // namespace News