@@ -74,7 +74,7 @@ public static TomlTypeInfo TryWrap(TomlTypeInfo typeInfo)
7474
7575 if ( string . IsNullOrEmpty ( discriminatorPropertyName ) )
7676 {
77- throw new InvalidOperationException ( $ "Polymorphic type '{ type . FullName } ' must specify a discriminator property name.") ;
77+ throw new TomlException ( $ "Polymorphic type '{ type . FullName } ' must specify a discriminator property name.") ;
7878 }
7979
8080 var derivedByDiscriminator = new Dictionary < string , Type > ( StringComparer . Ordinal ) ;
@@ -131,22 +131,22 @@ private static void AddDerivedType(
131131
132132 if ( discriminator . Length == 0 )
133133 {
134- throw new InvalidOperationException ( $ "Derived type discriminator for base '{ baseType . FullName } ' cannot be empty.") ;
134+ throw new TomlException ( $ "Derived type discriminator for base '{ baseType . FullName } ' cannot be empty.") ;
135135 }
136136
137137 if ( ! baseType . IsAssignableFrom ( derivedType ) )
138138 {
139- throw new InvalidOperationException ( $ "Derived type '{ derivedType . FullName } ' is not assignable to base type '{ baseType . FullName } '.") ;
139+ throw new TomlException ( $ "Derived type '{ derivedType . FullName } ' is not assignable to base type '{ baseType . FullName } '.") ;
140140 }
141141
142142 if ( derivedTypeByDiscriminator . ContainsKey ( discriminator ) )
143143 {
144- throw new InvalidOperationException ( $ "Multiple derived types are registered with discriminator '{ discriminator } ' for base '{ baseType . FullName } '.") ;
144+ throw new TomlException ( $ "Multiple derived types are registered with discriminator '{ discriminator } ' for base '{ baseType . FullName } '.") ;
145145 }
146146
147147 if ( discriminatorByDerivedType . ContainsKey ( derivedType ) )
148148 {
149- throw new InvalidOperationException ( $ "Derived type '{ derivedType . FullName } ' is registered multiple times for base '{ baseType . FullName } '.") ;
149+ throw new TomlException ( $ "Derived type '{ derivedType . FullName } ' is registered multiple times for base '{ baseType . FullName } '.") ;
150150 }
151151
152152 derivedTypeByDiscriminator . Add ( discriminator , derivedType ) ;
0 commit comments