static void ProcessExitResult(ProcessExitResultWithOutput result, TransferSpec spec) { if (result.ExitCode == 0) return; throw new RsyncException( String.Format("Did not exit gracefully (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); }
static void ProcessExitResult(ProcessExitResultWithOutput result, TransferSpec spec) { switch (result.ExitCode) { case 0: break; case -1: throw new RsyncSoftException( String.Format("Aborted/Killed (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 5: throw new RsyncSoftException( String.Format("Server full (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 10: throw new RsyncSoftException( String.Format("Connection refused (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 12: throw new RsyncSoftException( String.Format("Could not retrieve file (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 14: throw new RsyncSoftException( String.Format("Could not retrieve file due to IPC error (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 23: throw new RsyncSoftException( String.Format("Could not retrieve file (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 24: throw new RsyncSoftException( String.Format("Could not retrieve file (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 30: throw new RsyncSoftException( String.Format("Could not retrieve file due to Timeout (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 35: throw new RsyncSoftException( String.Format("Could not retrieve file due to Timeout (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); default: throw new RsyncException( String.Format("Did not exit gracefully (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); } }
static void ProcessExitResult(ProcessExitResultWithOutput result, TransferSpec spec) { if (spec.Progress.ZsyncIncompatible) { throw new ZsyncIncompatibleException( String.Format("Zsync Incompatible (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); } switch (result.ExitCode) { case 0: break; case -1: { if (spec.Progress.ZsyncLoopCount >= 2) { throw new ZsyncLoopDetectedException( String.Format("Loop detected, aborted transfer (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); } throw new ZsyncSoftException( String.Format("Aborted/Killed (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); } case 1: throw new ZsyncSoftException( String.Format( "Could not retrieve file due to protocol error (not a zsync file?) (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 2: throw new ZsyncSoftException( String.Format("Connection reset (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); case 3: throw new ZsyncSoftException( String.Format("Could not retrieve file (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); default: throw new ZsyncException( String.Format("Did not exit gracefully (PID: {0}, Status: {1}). {2}", result.Id, result.ExitCode, CreateTransferExceptionMessage(spec)), result.StandardOutput + result.StandardError, result.StartInfo.Arguments); } }
protected void HandleRsyncResponse(ProcessExitResultWithOutput response) { if (response.ExitCode == 0) return; throw new RsyncException(string.Format("Rsync [{0}] exited with code {1}\nOutput: {2}\nError: {3}", response.Id, response.ExitCode, response.StandardOutput, response.StandardError)); }
static void ProcessExitResult(ProcessExitResultWithOutput exitResult) { if (exitResult.ExitCode != 0) throw exitResult.GenerateException(); }