Skip to content

Conversation

@daogrady
Copy link
Contributor

@daogrady daogrady commented Oct 21, 2025

@daogrady daogrady requested a review from vkozyura October 21, 2025 08:04
@daogrady daogrady changed the title Add errors, messages, and results properties feat: Add errors, messages, and results properties Oct 21, 2025
@daogrady daogrady enabled auto-merge (squash) October 21, 2025 08:09
apis/events.d.ts Outdated

messages: {message: string, numericSeverity: levels}[]

errors: {message: string, stack: string}[]
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what should be visible in types. There are further properties like numericSeverity, code, target.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got these values from experimenting with a bookshop project.
Screenshot 2025-10-21 at 10 36 27
Screenshot 2025-10-21 at 10 37 10

I'll gladly add any properties that should be available (this also showcases why me experimentally determining them is vastly inferior to a runtime expert providing them with confidence 😕)

Copy link
Contributor

Choose a reason for hiding this comment

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

It depends on what you provide into req.error() as parameters. Try out req.error(code, message, target). For example req.error (400, 'Invalid input', 'some_field').

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I have added the fields accordingly, thanks for pointing that out!

@daogrady daogrady requested review from chgeo and vkozyura October 27, 2025 06:52
Copy link
Member

@chgeo chgeo left a comment

Choose a reason for hiding this comment

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

LGTM, but @vkozyura should have the say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Properties 'errors' and 'messages' do not exist on type cds.Request

4 participants