mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-12 10:22:04 +01:00
- 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
27 lines
830 B
C#
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);
|
|
}
|
|
|