Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions java/event-handlers/indicating-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ Writing the messages into explicitly modeled messages properties isn't yet suppo

SAP Fiori uses these messages to display detailed information on the UI. The style how a message appears on the UI depends on the severity of the message.

::: warning User Input & Injection Vulnerabilities
Ensure proper validation of the message text and URL if they contain values ​​from user input.
:::

### Throwing a ServiceException from Error Messages { #throwing-a-serviceexception-from-messages}

It is also possible to throw a [ServiceException](https://www.javadoc.io/doc/com.sap.cds/cds-services-api/latest/com/sap/cds/services/ServiceException.html) from error messages. This can, for example, be useful to cancel a request after collecting multiple validation errors. The individual validation checks will collect error messages in the `Messages` API. After the validation checks have been run, you call the `throwIfError()` method. Only if error messages have been collected, this method cancels the request with a [ServiceException](https://www.javadoc.io/doc/com.sap.cds/cds-services-api/latest/com/sap/cds/services/ServiceException.html):
Expand Down
3 changes: 3 additions & 0 deletions node.js/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ req.warn ('Some warning message')

The methods are similar to [`req.error()`](#req-error), also accepting the [same arguments](#req-reject), but the messages are collected in `req.messages` instead of `req.errors`, not decorated with stack traces, and returned in a HTTP response header (e.g. `sap-messages`), instead of the response body.

::: warning User Input & Injection Vulnerabilities
Ensure proper validation of the message text if it contains values ​​from user input.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not URL here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js seems not to support URLs

:::


## Error Responses
Expand Down
Loading