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

feat: improve error responses #719

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ricellis
Copy link
Member

PR summary

Add event hook for error response augmentation

Fixes: s1004

Note: An existing issue is required before opening a PR.

PR Checklist

Please make sure that your PR fulfills the following requirements:

  • The commit message follows the
    Angular Commit Message Guidelines.
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • New tests
  • Build/CI related changes
  • Documentation content changes
  • Other (please describe)

What is the current behavior?

Cloudant/CouchDB error models are handled by the core with only the error field being processed. Obtaining e.g. the reason field requires additional user code.

What is the new behavior?

The error response is augmented with errors and trace properties.
This improves the way the core handles the error response and enhances the user facing exception string to include the reason.
The trace is the CouchDB request ID which can be used to correlate with logs.

Does this PR introduce a breaking change?

  • Yes
  • No

The existing error model fields are retained, the new fields are backwards compatible.
Exception strings will be different, but the types remain the same.

Other information

Create _error_response_hook function to augment
error messages.
Add hook to the client requests session.
Unit tests for the hook.

@ricellis ricellis self-assigned this Oct 17, 2024
Create _error_response_hook function to augment
error messages.
Add hook to the client requests session.
Unit tests for the hook.
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.

1 participant