Files
o3de/Code/Tools/News/NewsShared/ErrorCodes.h
T
Steve Pham b4a2edec6a Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
2021-06-30 19:51:55 -07:00

52 lines
1.4 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* 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