From aa3335a9bc7c002a2d92cdc2349935986ab07b40 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Thu, 10 Jul 2025 13:43:15 +0200 Subject: [PATCH] example for custom error message --- java/event-handlers/indicating-errors.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/java/event-handlers/indicating-errors.md b/java/event-handlers/indicating-errors.md index 9d3ed726f..73e076753 100644 --- a/java/event-handlers/indicating-errors.md +++ b/java/event-handlers/indicating-errors.md @@ -132,6 +132,14 @@ You can disable these translated error messages by setting [cds.err ### Provide custom error messages By default, CAP Java provides error messages in several languages. If an error message or translation isn't sufficient for an application, it can be overwritten with a custom error message. Applications can provide the new error message under the respective error code in the application's `messages.properties` resource bundle under `src/main/resources`. + +::: code-group +```properties [message.properties] +# Custom message for @mandatory +409003 = Please enter a value +``` +::: + To know which error codes and messages are available by default, you can have a look at the Java enumeration `com.sap.cds.services.utils.CdsErrorStatuses` with your favorite IDE. This enumeration shows all available error codes and messages that are used by the CAP Java runtime. ## Target