Files
ChanSort/source/ChanSort.Api/LoaderException.cs
Horst Beham 4a1a39b1e7 - added function to mark a channel for swapping + swap with current channel
- replaced misuse of "FileLoadException" with a custom LoaderException to handle file loading issues with better continue/fail logic
- removed "Save As" and replaced it with "Convert list" menu item that shows information on how to use a reference list instead of direct conversion
2022-11-29 14:56:23 +01:00

27 lines
830 B
C#

using System;
namespace ChanSort;
public class LoaderException : Exception
{
public enum RecoveryMode { TryNext, Fail }
public RecoveryMode Recovery { get; }
private LoaderException(RecoveryMode recovery, string message, Exception inner) : base(message, inner)
{
Recovery = recovery;
}
/// <summary>
/// In case the loader detects an unsupported file content (or knows another loader is responsible for loading it)
/// </summary>
public static LoaderException TryNext(string message, Exception inner = null) => throw new LoaderException(RecoveryMode.TryNext, message, inner);
/// <summary>
/// Stop all loading attempts for the file
/// </summary>
public static LoaderException Fail(string message, Exception inner = null) => throw new LoaderException(RecoveryMode.Fail, message, inner);
}