//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// AFXUI auxiliary module for Blazor-application (WASM) | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Reflection;
using System.Runtime.CompilerServices;

using CommonHelpers.WASM;

namespace AFXUI {

//**************************************************************************************************
public class UEscapeException: Exception {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentNullException" />
public UEscapeException( Type throwingType,
                         [CallerMemberName][HRequired] string? methodNameOrSignature=null )
: this( throwingType.Name, HArgChecking.NN( methodNameOrSignature ) )
{}

/// <exception cref="ArgumentNullException" />
public UEscapeException( [HRequired] MethodBase? throwingMethod )
: this( HArgChecking.NN(throwingMethod).DeclaringType.NN(),
        HArgChecking.NN(throwingMethod).Name )
{}

//==================================================================================================

protected UEscapeException(string message)
: base( HString.ConvertAsText( message ) )
{}

/// <exception cref="ArgumentNullException" />
protected UEscapeException(string throwingTypeName,[HRequired] string? methodNameOrSignature)
: this( throwingTypeName, methodNameOrSignature, null )
{}

/// <exception cref="ArgumentNullException" />
protected UEscapeException( string throwingTypeName,
                            [HRequired] string? methodNameOrSignature,
                            string? additionalMessage )
: base(HString.FormatAsText(
   "Escape exception was thrown by: [{0}] {1}.{2}",
   throwingTypeName, HArgChecking.NN( methodNameOrSignature ),
   additionalMessage!=null ? "\n"+additionalMessage : "" ))
{}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // UEscapeException
//**************************************************************************************************

} // AFXUI
