Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ThrowException()

virtual void System.Reflection.Emit.ILGenerator.ThrowException ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type excType)
inlinevirtual

Definition at line 912 of file ILGenerator.cs.

913 {
914 if (excType == null)
915 {
916 throw new ArgumentNullException("excType");
917 }
918 if (!excType.IsSubclassOf(typeof(Exception)) && excType != typeof(Exception))
919 {
920 throw new ArgumentException(SR.Argument_NotExceptionType);
921 }
922 ConstructorInfo constructor = excType.GetConstructor(Type.EmptyTypes);
923 if (constructor == null)
924 {
925 throw new ArgumentException(SR.Argument_MissingDefaultConstructor);
926 }
927 Emit(OpCodes.Newobj, constructor);
928 Emit(OpCodes.Throw);
929 }

References System.SR.Argument_MissingDefaultConstructor, System.SR.Argument_NotExceptionType, System.Type.EmptyTypes, System.Type.GetConstructor(), System.Type.IsSubclassOf(), System.Reflection.Emit.OpCodes.Newobj, and System.Reflection.Emit.OpCodes.Throw.