FileshareErrorHelper
class FileshareErrorHelper
using Relativity.Transfer.FileShare.Resources;
using System;
using System.IO;
namespace Relativity.Transfer.FileShare
{
internal class FileshareErrorHelper
{
public static string (Exception exception)
{
if (exception is ArgumentException)
return FileShareStrings.TransferCommandArgumentExceptionMessage;
if (exception is PathTooLongException)
return FileShareStrings.TransferCommandLongPathExceptionMessage;
if (exception is IOException) {
if (IsDiskFull(exception))
return FileShareStrings.TransferCommandDiskFullExceptionMessage;
return FileShareStrings.TransferCommandOverwriteExceptionMessage;
}
if (exception is NotSupportedException)
return FileShareStrings.TransferCommandInvalidFormatExceptionMessage;
return exception.Message;
}
public static string (TransferPath path, Exception exception)
{
string text = GetErrorMessage(exception);
if (exception is FileNotFoundException) {
text = FileShareStrings.TransferCommandFileNotFoundCheckLogs;
if (path.SourcePath.Length >= 260)
text += FileShareStrings.LongPathWarningMessage;
return text;
}
if (exception is DirectoryNotFoundException && !string.IsNullOrEmpty(path.TargetPath) && path.TargetPath.Length >= 260)
text += FileShareStrings.LongPathWarningMessage;
return text;
}
public static bool (Exception ex)
{
if (ex.HResult != -2147024857)
return ex.HResult == -2147024784;
return true;
}
}
}