BlogBlogA post on somebody's own site or a community platform. Nobody edits it after publication, so it dates from the day it was written.See every one →SAP CommunityPart 2 of 2
SAP Cloud Application Programming Model(CAP):カスタムロジックの実装 – Part 2
A walkthrough of implementing custom logic in a CAP Node.js service for the capire bookshopcapire/bookshopThe primer of CAP: a bookshop small enough to read in one sitting, whose Books and Authors every CAP explanation, including this graph's, assumes you have already seen.sap official, cap sample, registering before, on and after handlers around the generated CRUD service for its Books and Orders entities. The before handler validates an incoming order's amount and runs a transactional CQN UPDATE to decrement stock, raising a 400 or 409 through req.error when the amount is invalid or no rows match; an after handler on READ appends a discount note to overstocked books.
Where it sits
Explains
Error handlingCAPError handlingTurning 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.Transaction managementCAPTransaction managementDeciding where a unit of work begins and ends, and what travels with it: the database transaction that commits or rolls back around a request, the user, tenant and locale that every nested call inherits, and the work that must run outside the request in a transaction of its own. Distinct from [concurrency control](capability:concurrency-control), which is two writers on one record, and from [async processing](capability:async-processing), which is work that survives the commit.
Source
reachable
Who is behind it
rasaiauthor
In this series
- 1
- 2SAP Cloud Application Programming Model(CAP):カスタムロジックの実装 – Part 2you are here
Properties
About this work
For error-handling
Applies in
Group by
Piece, what it offersStill applies
Effective Axios Error Logging for Robust SAP IntegrationsEffective Axios Error Logging for Robust SAP IntegrationsTwo logged failures printed side by side, and the point is made by looking at them: one tells you what went wrong and one does not. Axios buries the useful part of an HTTP error, and this is what to unwrap before logging it from a CAP service.Sahil2508, published 2025-08-31
Beginners Guide to Advanced Event MeshBeginners Guide to Advanced Event MeshA scenario-by-scenario walkthrough of Advanced Event Mesh, run through Cloud Integration iFlows: publishing and consuming queue messages, dead message queue setup with retry counts and acknowledgment modes, direct messages, durable topic endpoints and selectors, time-to-live, REST Delivery Points, replay by replication group message ID, parallel consumers with partition keys, and the request-reply pattern. Each scenario is built and verified step by step against a Solace trial account standing in for AEM.PriyankaChak, published 2025-07-24
Don't "let it crash", is this the new CAP guideline?Don't "let it crash", is this the new CAP guideline?Dinu traces a change in error handling in CAP's Node.js runtime: @sap/cds@8.2.0 adds a cds.server.shutdown_on_uncaught_errors config flag, defaulting to true, but invoking an operation with an undefined variable no longer takes the server down, with or without the flag, where the same code crashed it on cds@6 and cds@7, and the author notes the old behaviour was already missing in cds@8.1. It still crashes with features.odata_new_adapter turned off to use the old OData parser, so it is the new OData adapter, like the REST adapter before it, that answers an uncaught error with a 500 instead of taking the process down.Dinu, published 2024-09-06
Messaging System for Transferring Error, Warning, and Information Messages from OData V4 Services to HTTP Client ApplicationsMessaging System for Transferring Error, Warning, and Information Messages from OData V4 Services to HTTP Client ApplicationsGetting a message out of a CAP service and onto a Fiori elements object page in a draft scenario — errors, warnings and information, each of which the UI treats differently. Co-written with one of the people on the OData side, and it spends its length on the message container rather than on the handler that fills it.arley-triana-morin, published 2022-08-11
Messaging System for Transferring Error, Warning, and Information Messages from OData V4 Services to HTTP Client Applications
OData changed in @cap-js-community/odata-v2-adapter 1.10.0, 2023-04-05. Affects A recipe, Runnable code.
Details
Graph
Error handlingcapability, core and community
Transaction managementcapability, core only
SAP Communitypublishing source
SAP Communitycap-tag
Source
Type
blog
Published on
Host
community.sap.com
Discovered via
First seen
History
- Entered the atlasDiscovered via SAP Community · cap-tag.
For your agent
- Ref
content:sap-cloud-application-programming-model-cap-part-2- JSON
- /content/sap-cloud-application-programming-model-cap-part-2.json
- MCP
- Connecting an agent