Пример #1
0
        /// <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_FETCHSIZE:
                return("Failure fetching message size 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");
            }
        }
Пример #2
0
 /// <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;
 }
Пример #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Type">ImapErrorEnum</param>
 public ImapException(ImapErrorEnum Type)
 {
     errorType = Type;
     message   = GetDescription(Type);
 }
Пример #4
0
 /// <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;
 }
Пример #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Type">ImapErrorEnum</param>
 public ImapException(ImapErrorEnum Type)
 {
     errorType = Type;
     message = GetDescription(Type);
 }
Пример #6
0
        /// <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_FETCHSIZE:
                    return "Failure fetching message size 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");

            }
        }