An SDL wrapper library for .NET.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
842 B

using System;
namespace DotSDL.Exceptions {
/// <summary>
/// This <see cref="Exception"/> is thrown when an invalid type is used for
/// a genetic class or method.
/// </summary>
public class InvalidTypeException : Exception {
/// <summary>
/// Initializes an <see cref="InvalidTypeException"/>.
/// </summary>
/// <param name="objectName">The class or method that was called.</param>
/// <param name="invalidType">The invalid type that was passed.</param>
/// <param name="message">A message that should be appended to the base message.</param>
public InvalidTypeException(string objectName, Type invalidType, string message = "")
: base($"{objectName} cannot accept the type {nameof(invalidType)}" + message != "" ? $" ({message})" : "") { }
}
}