Files
UnrealEngineUWP/Engine/Source/Developer/SourceControl/Public/SourceControlResultInfo.h
paul chipchase f5464ba58b Allow additional error info to be stored in FSourceControlResultInfo.
#rb wouter.burgers
#jira UE-181418
#preflight 642ece61df6c5c78fc9b99c9

- Added FSourceControlResultInfo::EAdditionalErrorContext that describes additional info about errors that the operation might have encountered that the caller can poll for rather than trying to parse error strings.
-- NOTE that we cannot enforce this info to be provided by source control provider implementations so this additional info should only be used to improve error messages.
-- Initially we support the connection to the provider failing and the connection to the provider dropping mid operation.
- Moved FSourceControlResultInfo to its own code files.
- I wanted to move the implementation of FSourceControlResultInfo::Append to the cpp, but this causes linker problems even with SOURCECONTROL_API as some modules are not including source control properly. For now I have left it in the header file and will look into this in another code pass.

[CL 24943799 by paul chipchase in ue5-main branch]
2023-04-06 10:04:00 -04:00

55 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "CoreTypes.h"
#include "Internationalization/Text.h"
#include "Misc/EnumClassFlags.h"
/** Accumulated error and info messages for a source control operation. */
struct FSourceControlResultInfo
{
enum class EAdditionalErrorContext : uint32
{
None = 0,
/** A connection to the server could not be established */
ConnectionFailed = 1 << 0,
/** The connection to the server dropped before the operation could be completed */
ConnectionDropped = 1 << 1
};
FRIEND_ENUM_CLASS_FLAGS(EAdditionalErrorContext);
/** Append any messages from another FSourceControlResultInfo, ensuring to keep any already accumulated info. */
void Append(const FSourceControlResultInfo& InResultInfo)
{
InfoMessages.Append(InResultInfo.InfoMessages);
ErrorMessages.Append(InResultInfo.ErrorMessages);
Tags.Append(InResultInfo.Tags);
AdditionalErrorContext |= InResultInfo.AdditionalErrorContext;
}
SOURCECONTROL_API void OnConnectionFailed();
SOURCECONTROL_API void OnConnectionDroped();
SOURCECONTROL_API bool DidConnectionFail() const;
/** Info and/or warning message storage */
TArray<FText> InfoMessages;
/** Potential error message storage */
TArray<FText> ErrorMessages;
/** Additional arbitrary information attached to the command */
TArray<FString> Tags;
private:
/** Contains additional info about any errors encountered */
EAdditionalErrorContext AdditionalErrorContext = EAdditionalErrorContext::None;
};
ENUM_CLASS_FLAGS(FSourceControlResultInfo::EAdditionalErrorContext);