@@ -8,7 +8,7 @@ namespace AsyncAwaitBestPractices.MVVM;
88public class InvalidCommandParameterException : Exception
99{
1010 /// <summary>
11- /// Initializes a new instance of the <see cref="T:TaskExtensions.MVVM. InvalidCommandParameterException"/> class.
11+ /// Initializes a new instance of the <see cref="T:InvalidCommandParameterException"/> class.
1212 /// </summary>
1313 /// <param name="expectedType">Expected parameter type for AsyncCommand.Execute.</param>
1414 /// <param name="actualType">Actual parameter type for AsyncCommand.Execute.</param>
@@ -19,7 +19,7 @@ public InvalidCommandParameterException(Type expectedType, Type actualType, Exce
1919 }
2020
2121 /// <summary>
22- /// Initializes a new instance of the <see cref="T:TaskExtensions.MVVM. InvalidCommandParameterException"/> class.
22+ /// Initializes a new instance of the <see cref="T:InvalidCommandParameterException"/> class.
2323 /// </summary>
2424 /// <param name="expectedType">Expected parameter type for AsyncCommand.Execute.</param>
2525 /// <param name="actualType">Actual parameter type for AsyncCommand.Execute.</param>
@@ -29,25 +29,37 @@ public InvalidCommandParameterException(Type expectedType, Type actualType) : ba
2929 }
3030
3131 /// <summary>
32- /// Initializes a new instance of the <see cref="T:TaskExtensions.MVVM. InvalidCommandParameterException"/> class.
32+ /// Initializes a new instance of the <see cref="T:InvalidCommandParameterException"/> class.
3333 /// </summary>
3434 /// <param name="expectedType">Expected parameter type for AsyncCommand.Execute.</param>
3535 /// <param name="innerException">Inner Exception</param>
3636 public InvalidCommandParameterException ( Type expectedType , Exception innerException ) : base ( CreateErrorMessage ( expectedType ) , innerException )
3737 {
38-
38+ if ( innerException is null )
39+ throw new ArgumentNullException ( nameof ( innerException ) ) ;
3940 }
4041
4142 /// <summary>
42- /// Initializes a new instance of the <see cref="T:TaskExtensions.MVVM. InvalidCommandParameterException"/> class.
43+ /// Initializes a new instance of the <see cref="T:InvalidCommandParameterException"/> class.
4344 /// </summary>
4445 /// <param name="expectedType">Expected parameter type for AsyncCommand.Execute.</param>
4546 public InvalidCommandParameterException ( Type expectedType ) : base ( CreateErrorMessage ( expectedType ) )
4647 {
4748
4849 }
4950
50- static string CreateErrorMessage ( Type expectedType ) => $ "Invalid type for parameter. Expected Type { expectedType } ";
51+ static string CreateErrorMessage ( Type expectedType ) => expectedType is null
52+ ? throw new ArgumentNullException ( nameof ( expectedType ) )
53+ : $ "Invalid type for parameter. Expected Type { expectedType } ";
54+
55+ static string CreateErrorMessage ( Type expectedType , Type actualType )
56+ {
57+ if ( expectedType is null )
58+ throw new ArgumentNullException ( nameof ( expectedType ) ) ;
5159
52- static string CreateErrorMessage ( Type expectedType , Type actualType ) => $ "Invalid type for parameter. Expected Type { expectedType } , but received Type { actualType } ";
60+ if ( actualType is null )
61+ throw new ArgumentNullException ( nameof ( actualType ) ) ;
62+
63+ return $ "Invalid type for parameter. Expected Type { expectedType } , but received Type { actualType } ";
64+ }
5365}
0 commit comments