Skip to content

Commit 17510f5

Browse files
committed
Improve exception messages
Part of #7201
1 parent f9af67c commit 17510f5

File tree

16 files changed

+217
-179
lines changed

16 files changed

+217
-179
lines changed

src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs

+16-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/EFCore.Cosmos/Properties/CosmosStrings.resx

+10-10
Original file line numberDiff line numberDiff line change
@@ -148,25 +148,25 @@
148148
<value>Navigation '{entityType}.{navigationName}' doesn't point to an embedded entity.</value>
149149
</data>
150150
<data name="NoDiscriminatorProperty" xml:space="preserve">
151-
<value>The entity type '{entityType}' is sharing the container '{container}' with other types, but does not have a discriminator property configured.</value>
151+
<value>The entity type '{entityType}' is sharing the container '{container}' with other types, but does not have a discriminator property configured. Configure a discriminator property and assign a unique value for this entity type.</value>
152152
</data>
153153
<data name="NoDiscriminatorValue" xml:space="preserve">
154-
<value>The entity type '{entityType}' is sharing the container '{container}' with other types, but does not have a discriminator value configured.</value>
154+
<value>The entity type '{entityType}' is sharing the container '{container}' with other types, but does not have a discriminator value configured. Configure a unique discriminator value for this entity type.</value>
155155
</data>
156156
<data name="NoIdKey" xml:space="preserve">
157157
<value>The entity type '{entityType}' does not have a key declared on the '{idProperty}' property. Add a key to '{entityType}' that contains '{idProperty}'.</value>
158158
</data>
159159
<data name="NoIdProperty" xml:space="preserve">
160-
<value>The entity type '{entityType}' does not have a property mapped to the 'id' property in the database. Add a property mapped as 'id'.</value>
160+
<value>The entity type '{entityType}' does not have a property mapped to the 'id' property in the database. Add a property mapped to 'id'.</value>
161161
</data>
162162
<data name="NonEmbeddedIncludeNotSupported" xml:space="preserve">
163163
<value>Including navigation '{navigation}' is not supported as the navigation is not embedded in same resource.</value>
164164
</data>
165165
<data name="NonETagConcurrencyToken" xml:space="preserve">
166-
<value>The entity type '{entityType}' has property '{property}' as its concurrency token, but only '_etag' is supported. Consider using 'EntityTypeBuilder.UseETagConcurrency'.</value>
166+
<value>The entity type '{entityType}' has property '{property}' configured as a concurrency token, but only a property mapped to '_etag' is supported as a concurrency token. Consider using 'PropertyBuilder.IsETagConcurrency'.</value>
167167
</data>
168168
<data name="NoPartitionKey" xml:space="preserve">
169-
<value>The entity type '{entityType}' does not have a partition key set, but is mapped to the container '{container}' shared by entity types with partition keys. Configure a partition key on '{entityType}'.</value>
169+
<value>The entity type '{entityType}' does not have a partition key set, but is mapped to the container '{container}' shared by entity types with partition keys. Configure a compatible partition key on '{entityType}'.</value>
170170
</data>
171171
<data name="NoPartitionKeyKey" xml:space="preserve">
172172
<value>The entity type '{entityType}' does not have a key declared on '{partitionKey}' and '{idProperty}' properties. Add a key to '{entityType}' that contains '{partitionKey}' and '{idProperty}'.</value>
@@ -186,20 +186,20 @@
186186
<data name="OrphanedNestedDocumentSensitive" xml:space="preserve">
187187
<value>The entity of type '{entityType}' is mapped as part of the document mapped to '{missingEntityType}', but there is no tracked entity of this type with the key value '{keyValue}'.</value>
188188
</data>
189+
<data name="PartitionKeyMismatch" xml:space="preserve">
190+
<value>The partition key specified in the 'WithPartitionKey' call '{partitionKey1}' and the partition key specified in the 'Where' predicate '{partitionKey2}' must be identical to return any results. Remove one of them.</value>
191+
</data>
189192
<data name="PartitionKeyMissing" xml:space="preserve">
190193
<value>Unable to execute a 'ReadItem' query since the partition key value is missing. Consider using the 'WithPartitionKey' method on the query to specify partition key to use.</value>
191194
</data>
192-
<data name="PartitionKeyMismatch" xml:space="preserve">
193-
<value>The partition key specified in the 'WithPartitionKey' call '{partitionKey1}' and the partition key specified in the 'Where' predicate '{partitionKey2}' must be identical. Remove one of them.</value>
194-
</data>
195195
<data name="PartitionKeyMissingProperty" xml:space="preserve">
196196
<value>The partition key for entity type '{entityType}' is set to '{property}', but there is no property with that name.</value>
197197
</data>
198198
<data name="PartitionKeyNonStringStoreType" xml:space="preserve">
199199
<value>The type of the partition key property '{property}' on '{entityType}' is '{propertyType}'. All partition key properties need to be strings or have a string value converter.</value>
200200
</data>
201201
<data name="PartitionKeyStoreNameMismatch" xml:space="preserve">
202-
<value>The partition key property '{property1}' on '{entityType1}' is mapped as '{storeName1}', but the partition key property '{property2}' on '{entityType2}' is mapped as '{storeName2}'. All partition key properties need to be mapped to the same store property.</value>
202+
<value>The partition key property '{property1}' on '{entityType1}' is mapped as '{storeName1}', but the partition key property '{property2}' on '{entityType2}' is mapped as '{storeName2}'. All partition key properties need to be mapped to the same store property for entity types mapped to the same container.</value>
203203
</data>
204204
<data name="ResourceIdMissing" xml:space="preserve">
205205
<value>Unable to execute a 'ReadItem' query since the 'id' value is missing and cannot be generated.</value>
@@ -219,4 +219,4 @@
219219
<data name="VisitChildrenMustBeOverridden" xml:space="preserve">
220220
<value>'VisitChildren' must be overridden in the class deriving from 'SqlExpression'.</value>
221221
</data>
222-
</root>
222+
</root>

src/EFCore.Relational/Infrastructure/RelationalOptionsExtension.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public virtual RelationalOptionsExtension WithCommandTimeout(int? commandTimeout
144144
if (commandTimeout.HasValue
145145
&& commandTimeout <= 0)
146146
{
147-
throw new InvalidOperationException(RelationalStrings.InvalidCommandTimeout);
147+
throw new InvalidOperationException(RelationalStrings.InvalidCommandTimeout(commandTimeout));
148148
}
149149

150150
var clone = Clone();
@@ -172,7 +172,7 @@ public virtual RelationalOptionsExtension WithMaxBatchSize(int? maxBatchSize)
172172
if (maxBatchSize.HasValue
173173
&& maxBatchSize <= 0)
174174
{
175-
throw new InvalidOperationException(RelationalStrings.InvalidMaxBatchSize);
175+
throw new InvalidOperationException(RelationalStrings.InvalidMaxBatchSize(maxBatchSize));
176176
}
177177

178178
var clone = Clone();
@@ -200,7 +200,7 @@ public virtual RelationalOptionsExtension WithMinBatchSize(int? minBatchSize)
200200
if (minBatchSize.HasValue
201201
&& minBatchSize <= 0)
202202
{
203-
throw new InvalidOperationException(RelationalStrings.InvalidMinBatchSize);
203+
throw new InvalidOperationException(RelationalStrings.InvalidMinBatchSize(minBatchSize));
204204
}
205205

206206
var clone = Clone();

0 commit comments

Comments
 (0)