FAES/Utilities/FileAES_Utilities.cs
/// <summary>
/// Attempts to convert an Exception Thrown by FAES into a human-readable error
/// </summary>
/// <param name="exception">Exception</param>
/// <param name="showRawException">Show the raw exception</param>
/// <returns>Human-Readable Error</returns>
Attempts to convert an Exception Thrown by FAES into a human-readable error
Attempts to convert an Exception Thrown by FAES into a human - readable error
public static string FAES_ExceptionHandling(Exception exception, bool showRawException = false)
        {
            if (!showRawException)
            {
                switch (exception.Message)
                {
                    case "Error occurred in creating the UFAES file.":
                        return "ERROR: The chosen file(s) could not be compressed as a compressed version already exists in the Temp files! Consider using '--purgeTemp' if you are not using another instance of FileAES and this error persists.";
                    case "Error occurred in encrypting the UFAES file.":
                        return "ERROR: The compressed file could not be encrypted. Please close any other instances of FileAES and try again. Consider using '--purgeTemp' if you are not using another instance of FileAES and this error persists.";
                    case "Error occurred in the decryption of the FAES file.":
                        return "ERROR: The encrypted file could not be decrypted. Please close any other instances of FileAES and try again. Consider using '--purgeTemp' if you are not using another instance of FileAES and this error persists.";
                    case "Error occurred in deleting the UFAES file.":
                        return "ERROR: The compressed file could not be deleted. Please close any other instances of FileAES and try again. Consider using '--purgeTemp' if you are not using another instance of FileAES and this error persists.";
                    case "Error occurred in moving the FAES file after encryption.":
                        return "ERROR: The encrypted file could not be moved to the original destination! Please ensure that a file with the same name does not already exist.";
                    case "Error occurred while deleting the original file/folder.":
                        return "ERROR: The original file/folder could not be deleted after encryption! Please ensure that they are not in-use!";
                    case "Error occurred in decrypting the FAES file.":
                        return "ERROR: The encrypted file could not be decrypted. Please try again.";
                    case "Error occurred in extracting the UFAES file.":
                        return "ERROR: The compressed file could not be extracted! Consider using '--purgeTemp' if you are not using another instance of FileAES and this error persists.";
                    case "Password hint contains invalid characters.":
                        return "ERROR: Password Hint contains invalid characters. Please choose another password hint.";
                    case "FAES File was compressed using an unsupported file format.":
                        return "ERROR: The encrypted file was compressed using an unsupported file format. You are likely using an outdated version of FAES!";
                    case "This method only supports encrypted FAES Files!":
                        return "ERROR: The chosen file does not contain any MetaData since it is not an encrypted FAES File!";
                    case "Error occurred in SafeDeleteFile.":
                        return "ERROR: A file could not be deleted! Is the file in use?";
                    case "Error occurred in SafeDeleteFolder.":
                        return "ERROR: A folder could not be deleted! Is the folder in use?";
                    case "File/Folder not found at the specified path!":
                        return "ERROR: A file/folder was not found at the specified path!";
                    case "Error occurred since the file already exists.":
                        return "ERROR: File already exists at destination and overwriting is disabled!";
                    case "An unexpected error occurred when getting metadata!":
                        return "ERROR: An unexpected error occurred when getting metadata for the selected FAES file!";
                    case "An unexpected error occurred when creating an encryption path!":
                        return "ERROR: An unexpected error occurred when creating an encryption path for the chosen FAES File!";
                    case "Metadata cannot be found at this offset!":
                        return "ERROR: An unexpected error occured when reading FAESv3 metadata! A data chunk ended unexpectedly. Source file may be corrupted!";
                    default:
                        return exception.Message;
                }
            }
            return exception.ToString();
        }
public static string FAES_ExceptionHandling ( Exception exception , bool showRawException = false ) { if ( ! showRawException ) { switch ( exception . Message ) { case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; default : return exception . Message ; } } return exception . ToString ( ) ; }
Attempts to convert an Exception Thrown by FAES into a human-readable error
Attempts to convert an Exception Thrown by FAES into a human - readable error
None
exception
Exception
None
showRawException
bool
Show the raw exception
Show the raw exception