Files
RobustToolbox/Robust.Shared/Exceptions/TypeArgumentException.cs
Pieter-Jan Briers 816a535a92 Fix obsoletion warnings for BinaryFormatter stuff
This became an outright warning in .NET 8. Into the trash, never used it.
2023-12-15 19:37:13 +01:00

37 lines
1.1 KiB
C#

using System;
using System.Runtime.Serialization;
namespace Robust.Shared.Exceptions
{
/// <summary>
/// Thrown if a method is called with an invalid type argument.
/// For example <see cref="IoC.IoCManager.Register{TInterface, TImplementation}(bool)"/> with an abstract <code>TImplementation</code>.
/// </summary>
[Serializable]
public sealed class TypeArgumentException : Exception
{
/// <summary>
/// The name of the type argument that had invalid data.
/// </summary>
public readonly string? TypeArgumentName;
public TypeArgumentException()
{
}
public TypeArgumentException(string message) : base(message)
{
}
public TypeArgumentException(string message, Exception inner) : base(message, inner)
{
}
public TypeArgumentException(string message, string name) : base(message)
{
TypeArgumentName = name;
}
public TypeArgumentException(string message, string name, Exception inner) : base(message, inner)
{
TypeArgumentName = name;
}
}
}