Skip to content

feat(errors): add NotFoundError with resource_type and resource_id#25

Merged
codebestia merged 1 commit into
ShadeProtocol:mainfrom
xJeffx23:feature/not-found-error
Jun 24, 2026
Merged

feat(errors): add NotFoundError with resource_type and resource_id#25
codebestia merged 1 commit into
ShadeProtocol:mainfrom
xJeffx23:feature/not-found-error

Conversation

@xJeffx23

@xJeffx23 xJeffx23 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

Implements NotFoundError, a new exception raised on HTTP 404 responses. Exposes resource_type and resource_id attributes populated from the response body JSON, so callers can distinguish a missing payment from a
missing invoice without parsing the message string.

Fixes #(issue)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests added in tests/test_errors.py covering:

  • NotFoundError is instance of ShadeError
  • resource_type and resource_id parsed from JSON response body
  • Explicit kwargs override body values
  • Graceful None when body is missing, lacks fields, or is invalid JSON
  • from_response factory sets status_code=404 automatically
  • Package root exports NotFoundError

Run locally:
pytest tests/test_errors.py -v # 11 passed

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Closes #18

@codebestia codebestia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!
Nice Implementation.
Thank you for your contribution.

@codebestia codebestia merged commit 2a4df33 into ShadeProtocol:main Jun 24, 2026
1 check passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 24, 2026
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.

Implement NotFoundError

2 participants