c9050c7 feat: Use proper Error class when throwing client response errors
📊 Changes
1 file changed (+65 additions, -18 deletions)
View changed files
📝client/core/ts/src/lib.ts (+65 -18)
📄 Description
This PR improves the developer experience for using the komodo_client npm package:
Compensate for URLs with trailing slashes when joining api path
Implement a KomodoApiError class extending Error, used for api response rejection instead of plain object
Uses Error Cause for non-komodo errors
Error message is extracted from Serror, if present
Appends trace, if present, to stack string
Exposes response and SError as class fields
Many third party logging and network-wrapping libraries are used to handling rejected/thrown Error instances, so using a real Error means developers and end users get better readability and visibility into errors for free.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/moghtech/komodo/pull/805
**Author:** [@FoxxMD](https://github.com/FoxxMD)
**Created:** 9/4/2025
**Status:** 🔄 Open
**Base:** `main` ← **Head:** `apiClientImprove`
---
### 📝 Commits (2)
- [`e5f5552`](https://github.com/moghtech/komodo/commit/e5f5552e1cc4a292c560731ebc742f205119af42) feat: Make client URL usage more lenient
- [`c9050c7`](https://github.com/moghtech/komodo/commit/c9050c73c6714fc2c629091ebf347e45f30a05ed) feat: Use proper Error class when throwing client response errors
### 📊 Changes
**1 file changed** (+65 additions, -18 deletions)
<details>
<summary>View changed files</summary>
📝 `client/core/ts/src/lib.ts` (+65 -18)
</details>
### 📄 Description
This PR improves the developer experience for using the `komodo_client` npm package:
* Compensate for URLs with trailing slashes when joining api path
* Implement a `KomodoApiError` class extending `Error`, used for api response rejection instead of plain object
* Uses Error Cause for non-komodo errors
* Error message is extracted from Serror, if present
* Appends trace, if present, to stack string
* Exposes response and SError as class fields
Many third party logging and network-wrapping libraries are used to handling rejected/thrown `Error` instances, so using a real `Error` means developers and end users get better readability and visibility into errors for free.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/moghtech/komodo/pull/805
Author: @FoxxMD
Created: 9/4/2025
Status: 🔄 Open
Base:
main← Head:apiClientImprove📝 Commits (2)
e5f5552feat: Make client URL usage more lenientc9050c7feat: Use proper Error class when throwing client response errors📊 Changes
1 file changed (+65 additions, -18 deletions)
View changed files
📝
client/core/ts/src/lib.ts(+65 -18)📄 Description
This PR improves the developer experience for using the
komodo_clientnpm package:KomodoApiErrorclass extendingError, used for api response rejection instead of plain objectMany third party logging and network-wrapping libraries are used to handling rejected/thrown
Errorinstances, so using a realErrormeans developers and end users get better readability and visibility into errors for free.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.