Error handling

Turning a failure into a response a client can act on — protocol-correct error payloads, correlation, and a boundary between internal detail and what a caller sees.

Overview

InCAPassessed
SAP SHIPS
Node.js →

@sap/cds Provides req.error and req.reject, and serialises the result into protocol-correct payloads with target paths.

Java →

com.sap.cds:cds-services-bom Ships ServiceException for aborting an event with a mapped HTTP status and the Messages API for collecting errors, warnings, info and success messages on a request without aborting it, both usable without an extra dependency.

Not covered: It stops at the response the client receives. On Node.js in production a 5xx error goes out as its generic message only, and capire's advice for an unexpected error is to make sure it is logged and not to keep the app running; keeping a record of failures beyond a logging line and telling a person about them, which is notifications, are left to a plugin or the application's own code.

THE COMMUNITY ADDS

InABAPassessed

In ABAP the question is how a failure travels back to the caller: as a class-based exception, as a returned result object that carries the error, or as a message table such as BAPIRET2.

SAP SHIPS

Class-based exceptions: an exception is an instance of an exception class, raised with RAISE EXCEPTION or THROW in a conditional expression, and handled in the CATCH blocks of a TRY structure.

Not covered: At raising and catching. The language has no result value for an expected failure, and converting exception texts into BAPIRET2 or SYMSG for a caller is left to the application.

THE COMMUNITY ADDS

Libraries that return a failure as a value, such as RESULT-for-ABAP, and that convert exception texts into BAPIRET2 and SYMSG, such as sap-usi-exception. ABAP-PRC is a process framework that collects errors as messages and resumes a failed object on the step that failed.

Artifacts8

Group by8 of 8 artifacts
ArtifactSignals
CDS plugins1
cds-error-outboxCaptures CAP service errors, deduplicates them and mails alerts
Signals
Functional boundary
Packages7
@sap/cdsCAP Node.js runtime
Signals
none
ABAP-PRCFramework for multi-step ABAP processes with monitoring
Signals
Functional boundary
com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versions
Signals
none
EITHER-FOR-ABAPABAP class implementing the Either pattern
Signals
Quiet
RESULT-for-ABAPResult pattern for ABAP instead of exceptions for expected failures
Signals
none
sap-usi-exceptionShared root exception class and text getter for USI developments
Signals
none
throwRaises an ABAP exception from a text or the last system message
Signals
Quiet

Content16

Group by16 of 16 pieces
Piece, what it offers
S/4HANA Custom Development - What happens in case of errors in BAPIs or RAP BOs?
YouTube — SAP Developers playlists, SAP Developers, Talk
Building a Real‑Time Currency Conversion iFlow using SAP Cloud Integration (CPI)
SAP Community, RajeshwerRao_G_1, Blog
Connecting SAP Integration Suite with Slack: A Hands‑On Guide with Open Connectors
SAP Community, jareenabee_dudekula, Blog
Show 13 more
How to create a Purchase Order through BAPI in the SAP through program ( SE38 ) T-CODE .
SAP Community, chandu_kumar_badukuri, Blog
Parallel Data Filtering and Dropbox Integration Using SAP Cloud Integration
SAP Community, Vurumind03, Blog
New tutorial for UI5 Middleware FE Mockserver
SAP Community, Marian Zeis, Blog
Basic code's of ABAP
SAP Community, RakeshZore, Blog
Migration Journey from MuleSoft to SAP Integration Suite (CI)
SAP Community, Shailaja, Blog
Effective Axios Error Logging for Robust SAP Integrations
SAP Community, Sahil2508, BlogThe reasoningA recipe
How to subscribe or fetch data from solace to CPI using AEM Adapter : part-5
SAP Community, pavanKolla, Blog
Beginners Guide to Advanced Event Mesh
SAP Community, PriyankaChak, Blog
Making the Case for Enhanced REST Adapter in SAP Integration Suite
SAP Community, peter_ha3, Blog
SAP: Email Functionality in SAP with a Custom Function Module
SAP Community, Surendra_Karma, Blog
Don't "let it crash", is this the new CAP guideline?
SAP Community, Dinu, Blog
Messaging System for Transferring Error, Warning, and Information Messages from OData V4 Services to HTTP Client Applications
SAP Community, arley-triana-morin, BlogThe reasoningA recipeRunnable code
Core changed
SAP Cloud Application Programming Model(CAP):カスタムロジックの実装 – Part 2
SAP Community, rasai, part 2 of 2, Blog
S/4HANA Custom Development - What happens in case of errors in BAPIs or RAP BOs?
YouTube — SAP Developers playlists, SAP Developers, Talk
Don't "let it crash", is this the new CAP guideline?
SAP Community, Dinu, Blog

Seen working1

ArtifactSignals
Samples1
cap-java-snippetsTen short CAP Java references, one document per topic
none

Details

Coverage
statecore and community, CAP
assessed
state in ABAPcore and community, assessed
relationshipunassessed
also inABAP
SourceEvents and requests — req.error / req.rejectchecked SourceEvents and requests — Error Responseschecked SourceBest Practices — Error Handlingchecked SourceIndicating Errorschecked
For your agent
Ref
capability:error-handling
JSON
/capabilities/error-handling.json
MCP
Connecting an agent