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: Improve error message for disconnected connections #678

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

BobdenOs
Copy link
Contributor

@BobdenOs BobdenOs commented Jun 7, 2024

this._done is used from the default tx behavior. This can contain committed or rolled back. If this._done is not set it means the connection was never connected.

@@ -100,7 +100,7 @@ class HANAService extends SQLService {
}

ensureDBC() {
return this.dbc || cds.error`Database is disconnected`
return this.dbc || cds.error`Database connection is ${this._done || 'disconnected'}`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return this.dbc || cds.error`Database connection is ${this._done || 'disconnected'}`
return this.dbc || cds.error`Database connection ${this._done ? 'is ' + this._done || 'failed'}`

Copy link
Member

@patricebender patricebender left a comment

Choose a reason for hiding this comment

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

I think the error message I suggested reads better but no hard feelings

@johannes-vogel johannes-vogel merged commit eb4ef37 into main Jun 12, 2024
4 checks passed
@johannes-vogel johannes-vogel deleted the fix/error-closed-connection branch June 12, 2024 08:00
@cap-bots cap-bots mentioned this pull request Jun 12, 2024
johannes-vogel added a commit that referenced this pull request Jun 19, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[1.10.1](db-service-v1.10.0...db-service-v1.10.1)
(2024-06-19)


### Fixed

* Only check first row if no changes required
([#552](#552))
([39b0b85](39b0b85))
</details>

<details><summary>sqlite: 1.7.2</summary>

##
[1.7.2](sqlite-v1.7.1...sqlite-v1.7.2)
(2024-06-19)


### Fixed

* **deps:** update dependency better-sqlite3 to v11
([#669](#669))
([7167ec5](7167ec5))
</details>

<details><summary>hana: 1.0.0</summary>

##
[1.0.0](hana-v0.5.0...hana-v1.0.0)
(2024-06-19)


### Fixed

* Binary columns now return as Buffer for HANAService
([#689](#689))
([179bd92](179bd92))
* Improve error message for disconnected connections
([#678](#678))
([eb4ef37](eb4ef37))
* insertion of arrayed elements
([#677](#677))
([92cf307](92cf307))
* insertion of large decimals
([#686](#686))
([ae8abff](ae8abff))
* Support static conditions inside unmanaged associations
([#682](#682))
([e17ddfd](e17ddfd))
</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: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com>
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.

3 participants