CannotCastArgumentException.cs 875 B

12345678910111213141516171819202122
  1. using System;
  2. using Quadarax.Foundation.Core.Exceptions;
  3. namespace BO.AppServer.Business.Exceptions
  4. {
  5. // Invalid argument '{0}' value ({1}), cannot cast to type '{2}'.
  6. public class CannotCastArgumentException : CodeException
  7. {
  8. private const string CS_MESSAGE = "Cannot cast to type '{2}', invalid argument '{0}' value ({1}).";
  9. private const int CN_CODE = 1011;
  10. public CannotCastArgumentException(string argumentName, string argumentValue,Type expectedType, Exception innerException) : base(CN_CODE, string.Format(CS_MESSAGE,argumentName, argumentValue, expectedType.Name), innerException)
  11. {
  12. }
  13. public CannotCastArgumentException(string argumentName, string argumentValue,Type expectedType) : base(CN_CODE, string.Format(CS_MESSAGE,argumentName, argumentValue, expectedType.Name))
  14. {
  15. }
  16. }
  17. }