/// <summary> /// Create the APIException instance by the API response. /// </summary> /// <param name="client">REST client instance.</param> /// <returns></returns> public static APIException Factory(RESTClient client) { APIException resultException = null; var rawRsponse = client.RawResponse; var response = JObject.Parse(rawRsponse); if (response != null) { var status = response.Value<string>(APIMethod.FIELD_STATUS); if (status != null && status == APIMethod.STATUS_ERROR) { var result = response.Value<JObject>(APIMethod.FIELD_RESULT); if (result != null) { var exception = result.Value<string>(FIELD_EXCEPTION); if (exception != null) { var message = result.Value<string>(FIELD_MESSAGE); var itemName = result.Value<string>(FIELD_ITEM_NAME); if (!string.IsNullOrEmpty(message) && !string.IsNullOrEmpty(itemName)) { resultException = Factory(exception, new object[] { client, message, itemName }); } else if (!string.IsNullOrEmpty(message)) { resultException = Factory(exception, new object[] { client, message }); } else { resultException = Factory(exception, new object[] { client }); } } } } } if (resultException == null) { resultException = new APIException(client); } return resultException; }
public EmptyInputException(RESTClient client) : base(client, null) { }
public UserNotFoundException(RESTClient client) : base(client, null) { }
public UnsupportedRequestMethodException(RESTClient client) : base(client, null) { }
public UnsupportedVersionException(RESTClient client) : base(client, null) { }
public UnknownAccessTokenException(RESTClient client, string message) : base(client, message) { }
public UnsupportedRequestMethodException(RESTClient client, string message) : base(client, message) { }
public InvalidJSONException(RESTClient client) : base(client, null) { }
public InvalidSignatureException(RESTClient client, string message) : base(client, message) { }
public InvalidFieldException(RESTClient client, string itemName) : base(client, null, itemName) { }
public InvalidJSONException(RESTClient client, string message) : base(client, message) { }
public InvalidFieldException(RESTClient client, string message, string itemName) : base(client, message, itemName) { }
public ForbiddenMethodException(RESTClient client) : base(client, null) { }
public ForbiddenMethodException(RESTClient client, string message) : base(client, message) { }
public UnauthorizedUserException(RESTClient client, string message) : base(client, message) { }
public InvalidSignatureException(RESTClient client) : base(client, null) { }
public UnauthorizedUserException(RESTClient client) : base(client, null) { }
public MissingFieldException(RESTClient client, string message, string itemName) : base(client, "Missing field: " + itemName) { this.itemName = itemName; }
public UnknownAccessTokenException(RESTClient client) : base(client, null) { }
public MissingFieldException(RESTClient client, string itemName) : this(client, null, itemName) { }
/// <summary> /// Construct the exception instance. /// </summary> /// <param name="client">REST client instance.</param> public APIException(RESTClient client) : this(client, null) { }
public MissingHeaderException(RESTClient client, string message, string itemName) : base(client, message, itemName) { }
public UnsupportedVersionException(RESTClient client, string message) : base(client, message) { }
public MissingHeaderException(RESTClient client, string itemName) : base(client, null, itemName) { }
public UserNotFoundException(RESTClient client, string message) : base(client, message) { }
public SessionRestoreException(RESTClient client, string message) : base(client, message) { }
/// <summary> /// Construct the exception instance. /// </summary> /// <param name="client">REST client instance.</param> /// <param name="message">Exception message.</param> public APIException(RESTClient client, string message) : base(message) { this.client = client; prepareExceptionsMap(); }
public SessionRestoreException(RESTClient client) : base(client, null) { }
/// <summary> /// Construct the API method instance. /// </summary> /// <param name="rublon"></param> public APIMethod(RublonConsumer rublon) { this.rublon = rublon; client = new RESTClient(rublon); }
public EmptyInputException(RESTClient client, string message) : base(client, message) { }