public static bool IsContinuable(this ClientErrorCode errorCode) { switch (errorCode) { case ClientErrorCode.Ok: case ClientErrorCode.AlreadyConnected: case ClientErrorCode.RequestError: case ClientErrorCode.AlreadyHostingRoom: case ClientErrorCode.NotHostingRoom: case ClientErrorCode.ConnectionClosed: case ClientErrorCode.CreatingPortMappingFailed: case ClientErrorCode.NotReachable: case ClientErrorCode.InvalidOperation: return(true); case ClientErrorCode.FailedToConnect: case ClientErrorCode.NotConnected: case ClientErrorCode.SystemError: case ClientErrorCode.UnknownError: return(false); default: throw new ArgumentOutOfRangeException(nameof(errorCode), errorCode, null); } }
public static void InvariantCheck(bool assertion, string message, ClientErrorCode clientErrorCode = ClientErrorCode.NotSpecified) { if (!assertion) { throw new InvariantException(new DomainValidationError(message), "Invariant exception occurred. See errors collection for additional details.", clientErrorCode); } }
public InvariantException(string propertyName, string message, ClientErrorCode clientErrorCode = ClientErrorCode.NotSpecified) : base(message) { Verify.RequireStringNotNullOrWhitespace(propertyName, "propertyName"); ClientErrorCode = clientErrorCode; errors = new List <DomainValidationError> { new DomainValidationError(propertyName, message) }; }
public InvariantException(DomainValidationError error, ClientErrorCode clientErrorCode = ClientErrorCode.NotSpecified) : base(error.Message) { if (error == null) { throw new NullReferenceException("Domain validation error cannot be null."); } ClientErrorCode = clientErrorCode; errors = new List <DomainValidationError> { error }; }
public static string GetClientErrorMessage(this ClientErrorCode errorCode) { switch (errorCode) { case ClientErrorCode.Ok: return("Ok"); case ClientErrorCode.FailedToConnect: return("Failed to connect to the server."); case ClientErrorCode.RequestError: return("Request doesn't processed correctly on the server."); case ClientErrorCode.AlreadyConnected: return("The client is already connected to the server."); case ClientErrorCode.NotConnected: return("The client is not connected to the server."); case ClientErrorCode.AlreadyHostingRoom: return("The client is already hosting a room."); case ClientErrorCode.NotHostingRoom: return("The client is not hosting a room."); case ClientErrorCode.ConnectionClosed: return("The connection is closed."); case ClientErrorCode.UnknownError: return("Unexpected error."); case ClientErrorCode.CreatingPortMappingFailed: return("Failed to create port mapping to NAT."); case ClientErrorCode.NotReachable: return("This machine is not reachable from machines via internet."); case ClientErrorCode.SystemError: return("System or network internal error. Not continuable."); case ClientErrorCode.InvalidOperation: return("Requested operation is invalid."); default: return(""); } }
public ClientException(string message = "Errore sconosciuto", ClientErrorCode err = ClientErrorCode.Default) : base(message) { this.__err_code = err; }
public ClientErrorException(ClientErrorCode errorCode) : base(errorCode.GetClientErrorMessage()) { ClientErrorCode = errorCode; }
public BoltClientException(ClientErrorCode error, string action) : base($"Execution of action '{action}' failed on client with error '{error}'.") { Action = action; Error = error; }
public BoltClientException(string message, ClientErrorCode error, string action, Exception innerException) : base(message, innerException) { Error = error; Action = action; }
public BoltClientException(ClientErrorCode error, MethodInfo action) : base($"Execution of action '{action.Name}' failed on client with error '{error}'.") { Action = action; Error = error; }
public BoltClientException(string message, ClientErrorCode error, MethodInfo action, Exception innerException) : base(message, innerException) { Error = error; Action = action; }
/// <summary> /// Initializes a new instance of the <see cref="IgniteClientException"/> class. /// </summary> /// <param name="info">Serialization information.</param> /// <param name="ctx">Streaming context.</param> protected IgniteClientException(SerializationInfo info, StreamingContext ctx) : base(info, ctx) { _errorCode = (ClientErrorCode)info.GetInt32(ErrorCodeField); }
/// <summary> /// Verifies a set of invariants on a particular domain object. /// </summary> /// <param name="invariants">List of invariants to check.</param> /// <param name="domainObjectType">The type of domain object being validated.</param> /// <param name="clientErrorCode">A client-specific error code that provides additional details about the error.</param> /// <exception cref="InvariantException">Thrown if any of the invariants fail. Domain validation error(s) in the exception list /// the specific failures.</exception> public static void InvariantCheck(IList <Invariant> invariants, string domainObjectType, ClientErrorCode clientErrorCode = ClientErrorCode.NotSpecified) { InvariantException exception = null; //Check all of the invariants and add DomainValidationErrors if they fail. foreach (Invariant invariant in invariants.Where(invariant => !invariant.Condition)) { var domainValidationError = new DomainValidationError(invariant.PropertyName, invariant.Message); if (exception == null) { exception = new InvariantException(domainValidationError, String.Format("There was a problem validating the {0}.", domainObjectType), clientErrorCode); } else { exception.Add(domainValidationError); } } if (exception != null) { throw exception; } }
public ClientErrorException(ClientErrorCode errorCode, string extraMessage) : base( errorCode.GetClientErrorMessage() + ": " + extraMessage) { ClientErrorCode = errorCode; ExtraMessage = extraMessage; }
public ClientException(string message = "Errore sconosciuto", ClientErrorCode err = ClientErrorCode.Default) : base(message) { this.__err_code = err; }
public ErrorInfo(ClientErrorCode errorCode) { this.errorCode = errorCode; message = ""; }
public InvariantException(string message, ClientErrorCode clientErrorCode = ClientErrorCode.NotSpecified) : base(message) { ClientErrorCode = clientErrorCode; }
public SocketErrorData(ClientErrorCode errorCode, string error) { this.m_errorCode = errorCode; this.m_errorStr = error; }
/// <summary> /// Verifies a set of invariants on a particular domain object. /// </summary> /// <param name="invariants">List of invariants to check.</param> /// <param name="domainObjectType">The type of domain object being validated.</param> /// <param name="clientErrorCode">A client-specific error code that provides additional details about the error.</param> /// <exception cref="InvariantException">Thrown if any of the invariants fail. Domain validation error(s) in the exception list /// the specific failures.</exception> public static void InvariantCheck(IList <Invariant> invariants, Type domainObjectType, ClientErrorCode clientErrorCode = ClientErrorCode.NotSpecified) { InvariantCheck(invariants, domainObjectType.Name, clientErrorCode); }
/// <summary> /// Initializes a new instance of the <see cref="IgniteClientException" /> class. /// </summary> /// <param name="message">The message.</param> /// <param name="cause">The cause.</param> /// <param name="statusCode">The error code.</param> public IgniteClientException(string message, Exception?cause, ClientErrorCode statusCode) : base(message, cause) { _errorCode = statusCode; }