Skip to content

Commit 76bae22

Browse files
azahnencportele
andauthored
improve crud error messages (#425)
Co-authored-by: Clemens Portele <[email protected]>
1 parent 03d35a8 commit 76bae22

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

xtraplatform-features-sql/src/main/java/de/ii/xtraplatform/features/sql/domain/FeatureProviderSql.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,6 @@ public boolean supportsMutationsInternal() {
931931
return false;
932932
}
933933
if (!getData().getDatasetChanges().isModeCrud()) {
934-
LOGGER.warn(
935-
"Feature provider with id '{}' does not support mutations: datasetChanges.mode is not 'CRUD'",
936-
getId());
937934
return false;
938935
}
939936

@@ -1340,10 +1337,17 @@ private MutationResult writeFeatures(
13401337
.withResult((Builder) builder)
13411338
.handleError(
13421339
(result, throwable) -> {
1343-
Throwable error =
1344-
throwable instanceof PSQLException || throwable instanceof JsonParseException
1345-
? new IllegalArgumentException(throwable.getMessage())
1346-
: throwable;
1340+
Throwable error = throwable;
1341+
1342+
if (throwable instanceof PSQLException
1343+
|| throwable instanceof JsonParseException) {
1344+
error =
1345+
new IllegalArgumentException(
1346+
"Invalid feature data. You may be able to obtain more information about the problem by adding the header ‘Prefer: handling=strict’ to the request.",
1347+
throwable);
1348+
LogContext.errorAsDebug(LOGGER, throwable, "Error during feature mutation");
1349+
}
1350+
13471351
return result.error(error);
13481352
})
13491353
.handleItem((Builder::addIds))

0 commit comments

Comments
 (0)