Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Throw 'new Error' instead of string on $search with multiple words #472

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

nils
Copy link
Contributor

@nils nils commented Feb 20, 2024

This patch improves the error handling for #127 by showing a slightly better understandable error message to the user.

Before:
image

After:
image

Seems like CAP expects an Error instance these days, because it accesses error.message.
Parameter 'error.message' must be type of 'string'

CDS setup

@sap/cds: 7.3.1
@sap/cds-compiler: 4.3.2
@sap/cds-dk (global): 7.3.2
@sap/cds-fiori: 1.1.0
@sap/cds-foss: 4.0.2
@sap/cds-mtxs: 1.12.1
@sap/eslint-plugin-cds: 2.6.3
Node.js: v18.19.1
cds-dbs: 1.3.1

@nils nils changed the title Throw 'new Error' instead of string on $search with multiple words Fix: Throw 'new Error' instead of string on $search with multiple words Feb 20, 2024
@nils nils changed the title Fix: Throw 'new Error' instead of string on $search with multiple words fix: Throw 'new Error' instead of string on $search with multiple words Feb 20, 2024
@johannes-vogel
Copy link
Contributor

@nils Thanks for the PR. It should definitely be errors that we throw.

@johannes-vogel johannes-vogel merged commit 51be94d into cap-js:main Feb 20, 2024
2 of 4 checks passed
@cap-bots cap-bots mentioned this pull request Feb 20, 2024
patricebender added a commit that referenced this pull request Feb 21, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>db-service: 1.6.3</summary>

##
[1.6.3](db-service-v1.6.2...db-service-v1.6.3)
(2024-02-20)


### Fixed

* **`cqn4sql`:** be robust against `$self.&lt;element&gt;` references
([#471](#471))
([2921b0e](2921b0e))
* **cds.infer:** Always use srv.model
([#451](#451))
([41cf4a2](41cf4a2))
* Throw 'new Error' instead of string on $search with multiple words
([#472](#472))
([51be94d](51be94d))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Patrice Bender <[email protected]>
@nils nils deleted the search-throw-error-not-string branch March 5, 2024 13:00
@cap-bots cap-bots mentioned this pull request Jul 18, 2024
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.

2 participants