Description
The generic handle_before, handle_after, handle_on, and event-specific variants (handle_READ, handle_CREATE, handle_UPDATE, handle_DELETE) have been removed from CDS services without replacement. These internal hook methods were never part of the public API and were used in some projects to intercept event processing at a lower level than the standard before/on/after registration pattern. Any service that calls or overrides these methods will throw a runtime error in CDS 10. The standard event registration API (this.before(...), this.on(...), this.after(...)) covers all use cases these generics addressed.
How to Check
- [ ] Search for calls to
handle_before,handle_after,handle_onon any service instance or class. - [ ] Search for calls to
handle_READ,handle_CREATE,handle_UPDATE,handle_DELETE. - [ ] Search for method definitions in service subclasses that override any
handle_*method (e.g.handle_READ(req) { ... }). - [ ] Search across all source files including
lib/andtest/directories.
Migration Steps
Replace
handle_before/handle_after/handle_onoverrides with the standardbefore/after/onregistration in the service'sinit()method:diffclass MyService extends cds.ApplicationService { - handle_before(req) { - // custom logic before any event - } + async init() { + this.before('*', req => { + // custom logic before any event + }); + return super.init(); + } }Replace event-specific
handle_READ/handle_CREATE/handle_UPDATE/handle_DELETEoverrides with the correspondingonhandler:diffclass MyService extends cds.ApplicationService { - handle_READ(req) { - return super.handle_READ(req); - } + async init() { + this.on('READ', async req => { + // custom READ logic + }); + return super.init(); + } }Remove any direct call sites (
srv.handle_READ(req)) — these cannot be replicated via the public API. Refactor to emit the event throughsrv.run(req)or restructure the calling code to use service-level dispatching.
Notes
The handle_* methods were internal to the CAP framework dispatcher and had no stable contract. Projects that relied on them to intercept or augment processing may need a more significant refactor to achieve the same result using the standard registration API.