using System; namespace Unity.Services.Core { /// /// A base exception type for failed requests. /// public class RequestFailedException : Exception { /// /// Gets the error code for the failure. /// /// /// See for common error codes. Consult the /// service documentation for specific error codes various APIs can return. /// public int ErrorCode { get; } /// /// Creates an exception. /// /// /// /// The exception message is typically the "detail" field from the error /// response returned by the service when it is available. /// /// /// The error code is the "code" field from the error response returned /// by the service when it is available. See /// for common error codes. /// /// /// The error code returned by the service. /// A message describing the error. public RequestFailedException(int errorCode, string message) : this(errorCode, message, null) { } /// /// Creates an exception. /// /// /// /// The exception message is typically the "detail" field from the error /// response returned by the service when it is available. /// /// /// The error code is the "code" field from the error response returned /// by the service when it is available. See /// for common error codes. /// /// /// The error code returned by the service. /// A message describing the error. /// The inner exception reference. public RequestFailedException(int errorCode, string message, Exception innerException) : base(message, innerException) { this.ErrorCode = errorCode; } } }