using System; namespace LeanCloud { /// /// Exceptions that may occur when sending requests to LeanCloud. /// public class AVException : Exception { /// /// Error codes that may be delivered in response to requests to LeanCloud. /// public enum ErrorCode { /// /// Error code indicating that an unknown error or an error unrelated to LeanCloud /// occurred. /// OtherCause = -1, /// /// Error code indicating that something has gone wrong with the server. /// If you get this error code, it is LeanCloud's fault. /// InternalServerError = 1, /// /// Error code indicating the connection to the LeanCloud servers failed. /// ConnectionFailed = 100, /// /// Error code indicating the specified object doesn't exist. /// ObjectNotFound = 101, /// /// Error code indicating you tried to query with a datatype that doesn't /// support it, like exact matching an array or object. /// InvalidQuery = 102, /// /// Error code indicating a missing or invalid classname. Classnames are /// case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the /// only valid characters. /// InvalidClassName = 103, /// /// Error code indicating an unspecified object id. /// MissingObjectId = 104, /// /// Error code indicating an invalid key name. Keys are case-sensitive. They /// must start with a letter, and a-zA-Z0-9_ are the only valid characters. /// InvalidKeyName = 105, /// /// Error code indicating a malformed pointer. You should not see this unless /// you have been mucking about changing internal LeanCloud code. /// InvalidPointer = 106, /// /// Error code indicating that badly formed JSON was received upstream. This /// either indicates you have done something unusual with modifying how /// things encode to JSON, or the network is failing badly. /// InvalidJSON = 107, /// /// Error code indicating that the feature you tried to access is only /// available internally for testing purposes. /// CommandUnavailable = 108, /// /// You must call LeanCloud.initialize before using the LeanCloud library. /// NotInitialized = 109, /// /// Error code indicating that a field was set to an inconsistent type. /// IncorrectType = 111, /// /// Error code indicating an invalid channel name. A channel name is either /// an empty string (the broadcast channel) or contains only a-zA-Z0-9_ /// characters and starts with a letter. /// InvalidChannelName = 112, /// /// Error code indicating that push is misconfigured. /// PushMisconfigured = 115, /// /// Error code indicating that the object is too large. /// ObjectTooLarge = 116, /// /// Error code indicating that the operation isn't allowed for clients. /// OperationForbidden = 119, /// /// Error code indicating the result was not found in the cache. /// CacheMiss = 120, /// /// Error code indicating that an invalid key was used in a nested /// JSONObject. /// InvalidNestedKey = 121, /// /// Error code indicating that an invalid filename was used for AVFile. /// A valid file name contains only a-zA-Z0-9_. characters and is between 1 /// and 128 characters. /// InvalidFileName = 122, /// /// Error code indicating an invalid ACL was provided. /// InvalidACL = 123, /// /// Error code indicating that the request timed out on the server. Typically /// this indicates that the request is too expensive to run. /// Timeout = 124, /// /// Error code indicating that the email address was invalid. /// InvalidEmailAddress = 125, /// /// Error code indicating that a unique field was given a value that is /// already taken. /// DuplicateValue = 137, /// /// Error code indicating that a role's name is invalid. /// InvalidRoleName = 139, /// /// Error code indicating that an application quota was exceeded. Upgrade to /// resolve. /// ExceededQuota = 140, /// /// Error code indicating that a Cloud Code script failed. /// ScriptFailed = 141, /// /// Error code indicating that a Cloud Code validation failed. /// ValidationFailed = 142, /// /// Error code indicating that deleting a file failed. /// FileDeleteFailed = 153, /// /// Error code indicating that the application has exceeded its request limit. /// RequestLimitExceeded = 155, /// /// Error code indicating that the provided event name is invalid. /// InvalidEventName = 160, /// /// Error code indicating that the username is missing or empty. /// UsernameMissing = 200, /// /// Error code indicating that the password is missing or empty. /// PasswordMissing = 201, /// /// Error code indicating that the username has already been taken. /// UsernameTaken = 202, /// /// Error code indicating that the email has already been taken. /// EmailTaken = 203, /// /// Error code indicating that the email is missing, but must be specified. /// EmailMissing = 204, /// /// Error code indicating that a user with the specified email was not found. /// EmailNotFound = 205, /// /// Error code indicating that a user object without a valid session could /// not be altered. /// SessionMissing = 206, /// /// Error code indicating that a user can only be created through signup. /// MustCreateUserThroughSignup = 207, /// /// Error code indicating that an an account being linked is already linked /// to another user. /// AccountAlreadyLinked = 208, /// /// Error code indicating that the current session token is invalid. /// InvalidSessionToken = 209, /// /// Error code indicating that a user cannot be linked to an account because /// that account's id could not be found. /// LinkedIdMissing = 250, /// /// Error code indicating that a user with a linked (e.g. Facebook) account /// has an invalid session. /// InvalidLinkedSession = 251, /// /// Error code indicating that a service being linked (e.g. Facebook or /// Twitter) is unsupported. /// UnsupportedService = 252, /// /// 手机号不合法 /// MobilePhoneInvalid = 253 } internal AVException(ErrorCode code, string message, Exception cause = null) : base(message, cause) { this.Code = code; } /// /// The LeanCloud error code associated with the exception. /// public ErrorCode Code { get; private set; } } }