/// <summary> /// Get Description for specified type /// </summary> /// <param name="type">ImapErrorEnum type</param> /// <returns>string</returns> private string GetDescription(IMAPErrorEnum type) { switch (type) { case IMAPErrorEnum.IMAP_ERR_URI: return "Failure parsing the IMAP URL."; case IMAPErrorEnum.IMAP_ERR_MESSAGEUID: return "Invalid UserName/Password in the IMAP URL."; case IMAPErrorEnum.IMAP_ERR_CONNECT: return "Failure connecting to the IMAP server."; case IMAPErrorEnum.IMAP_ERR_NOTCONNECTED: return "Not connected to any IMAP server. Do Login first."; case IMAPErrorEnum.IMAP_ERR_LOGIN: return "Failed authenticating the user/password in the IMAP server."; case IMAPErrorEnum.IMAP_ERR_INSUFFICIENT_DATA: return "Not enough data to Restore the connection."; case IMAPErrorEnum.IMAP_ERR_LOGOUT: return "Failed to Logout from IMAP server."; case IMAPErrorEnum.IMAP_ERR_TIMEOUT: return "Timeout while waiting for response from the IMAP server."; case IMAPErrorEnum.IMAP_ERR_SOCKET: return "Socket Error. Failed receiving message."; case IMAPErrorEnum.IMAP_ERR_QUOTA: return "Failure getting the quota information for the folder/mailbox."; case IMAPErrorEnum.IMAP_ERR_SELECT: return "Failure selecting IMAP folder/mailbox."; case IMAPErrorEnum.IMAP_ERR_NOTSELECTED: return "No Folder is currently selected."; case IMAPErrorEnum.IMAP_ERR_EXAMINE: return "Failure examining IMAP folder/mailbox."; case IMAPErrorEnum.IMAP_ERR_SEARCH: return "Failure searching IMAP with the given criteria."; case IMAPErrorEnum.IMAP_ERR_SEARCH_EXACT: return "Failure getting the exact search value."; case IMAPErrorEnum.IMAP_ERR_INVALIDSEARCHKEY: return "Unsupported search key passed to SearchMessage API."; case IMAPErrorEnum.IMAP_ERR_GETMIME: return "Failure fetching mime for the message."; case IMAPErrorEnum.IMAP_ERR_FETCHMSG: return "Failure fetching message from IMAP folder/mailbox."; case IMAPErrorEnum.IMAP_ERR_MEMALLOC: return "Failure allocating memory."; case IMAPErrorEnum.IMAP_ERR_ENCODINGERROR: return "Failure encoding audio message."; case IMAPErrorEnum.IMAP_ERR_FILEIO: return "Failure reading/writing the audio content to file."; case IMAPErrorEnum.IMAP_ERR_STOREMSG: return "Failure storing message in IMAP."; case IMAPErrorEnum.IMAP_ERR_EXPUNGE: return "Failure permanently deleting marked messages (EXPUNGE)."; case IMAPErrorEnum.IMAP_ERR_INVALIDPARAM: return "Invalid parameter passed to API. See Log for details"; case IMAPErrorEnum.IMAP_ERR_CAPABILITY: return "Failure capability command."; case IMAPErrorEnum.IMAP_ERR_SERIOUS: return "Serious Problem with IMAP. Contact System Admin."; case IMAPErrorEnum.IMAP_ERR_FETCHBODYSTRUCT: return "Failure bodystructure command"; default: throw new Exception("UnKnow Exception"); } }
/// <summary> /// Constructor /// </summary> /// <param name="Type">ImapErrorEnum</param> /// <param name="error">string</param> public IMAPException(IMAPErrorEnum Type, string error) { errorType = Type; message = GetDescription(Type); message = message + " " + error; }
/// <summary> /// Constructor /// </summary> /// <param name="Type">ImapErrorEnum</param> public IMAPException(IMAPErrorEnum Type) { errorType = Type; message = GetDescription(Type); }
/// <summary> /// Get Description for specified type /// </summary> /// <param name="type">ImapErrorEnum type</param> /// <returns>string</returns> private string GetDescription(IMAPErrorEnum type) { switch (type) { case IMAPErrorEnum.IMAP_ERR_URI: return("Failure parsing the IMAP URL."); case IMAPErrorEnum.IMAP_ERR_MESSAGEUID: return("Invalid UserName/Password in the IMAP URL."); case IMAPErrorEnum.IMAP_ERR_CONNECT: return("Failure connecting to the IMAP server."); case IMAPErrorEnum.IMAP_ERR_NOTCONNECTED: return("Not connected to any IMAP server. Do Login first."); case IMAPErrorEnum.IMAP_ERR_LOGIN: return("Failed authenticating the user/password in the IMAP server."); case IMAPErrorEnum.IMAP_ERR_INSUFFICIENT_DATA: return("Not enough data to Restore the connection."); case IMAPErrorEnum.IMAP_ERR_LOGOUT: return("Failed to Logout from IMAP server."); case IMAPErrorEnum.IMAP_ERR_TIMEOUT: return("Timeout while waiting for response from the IMAP server."); case IMAPErrorEnum.IMAP_ERR_SOCKET: return("Socket Error. Failed receiving message."); case IMAPErrorEnum.IMAP_ERR_QUOTA: return("Failure getting the quota information for the folder/mailbox."); case IMAPErrorEnum.IMAP_ERR_SELECT: return("Failure selecting IMAP folder/mailbox."); case IMAPErrorEnum.IMAP_ERR_NOTSELECTED: return("No Folder is currently selected."); case IMAPErrorEnum.IMAP_ERR_EXAMINE: return("Failure examining IMAP folder/mailbox."); case IMAPErrorEnum.IMAP_ERR_SEARCH: return("Failure searching IMAP with the given criteria."); case IMAPErrorEnum.IMAP_ERR_SEARCH_EXACT: return("Failure getting the exact search value."); case IMAPErrorEnum.IMAP_ERR_INVALIDSEARCHKEY: return("Unsupported search key passed to SearchMessage API."); case IMAPErrorEnum.IMAP_ERR_GETMIME: return("Failure fetching mime for the message."); case IMAPErrorEnum.IMAP_ERR_FETCHMSG: return("Failure fetching message from IMAP folder/mailbox."); case IMAPErrorEnum.IMAP_ERR_MEMALLOC: return("Failure allocating memory."); case IMAPErrorEnum.IMAP_ERR_ENCODINGERROR: return("Failure encoding audio message."); case IMAPErrorEnum.IMAP_ERR_FILEIO: return("Failure reading/writing the audio content to file."); case IMAPErrorEnum.IMAP_ERR_STOREMSG: return("Failure storing message in IMAP."); case IMAPErrorEnum.IMAP_ERR_EXPUNGE: return("Failure permanently deleting marked messages (EXPUNGE)."); case IMAPErrorEnum.IMAP_ERR_INVALIDPARAM: return("Invalid parameter passed to API. See Log for details"); case IMAPErrorEnum.IMAP_ERR_CAPABILITY: return("Failure capability command."); case IMAPErrorEnum.IMAP_ERR_SERIOUS: return("Serious Problem with IMAP. Contact System Admin."); case IMAPErrorEnum.IMAP_ERR_FETCHBODYSTRUCT: return("Failure bodystructure command"); default: throw new Exception("UnKnow Exception"); } }