// Copyright Epic Games, Inc. All Rights Reserved. using System; namespace EpicGames.Perforce { #pragma warning disable CS1591 /// /// Error severity codes. Taken from the p4java documentation. /// public enum PerforceSeverityCode { Empty = 0, Info = 1, Warning = 2, Failed = 3, Fatal = 4, } /// /// Generic error codes that can be returned by the Perforce server. Taken from the p4java documentation. /// public enum PerforceGenericCode { None = 0, Usage = 1, Unknown = 2, Context = 3, Illegal = 4, NotYet = 5, Protect = 6, Empty = 17, Fault = 33, Client = 34, Admin = 35, Config = 36, Upgrade = 37, Comm = 38, TooBig = 39, } #pragma warning restore CS1591 /// /// Represents a error return value from Perforce. /// public class PerforceError { /// /// The severity of this error /// [PerforceTagAttribute("severity")] public PerforceSeverityCode Severity { get; set; } /// /// The generic error code associated with this message /// [PerforceTagAttribute("generic")] public PerforceGenericCode Generic { get; set; } /// /// The message text /// [PerforceTagAttribute("data")] public string Data { get; set; } /// /// Private constructor for serialization /// private PerforceError() { Data = null!; } /// /// Formats this error for display in the debugger /// /// String representation of this object public override string ToString() { return String.Format("{0}: {1} (Generic={2})", Severity, Data.TrimEnd(), Generic); } } }