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: support expired preview token and repository not found API error #328

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Oct 10, 2023

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This PR adds support for two errors in response to the Prismic Document API.

  • PreviewTokenExpiredError: Thrown when a query's preview token (used as a ref) is expired. This error extends from ForbiddenError for consistency with the other ref-related errors.
  • RepositoryNotFoundError: Thrown when a Prismic repository does not exist. This error was previously thrown as NotFoundError. Thus, the new error extends from NotFoundError to ensure this change is non-breaking.

The new errors will extend from PrismicError in a future major version for better semantics.

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

🐤

@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (163d03e) 99.97% compared to head (f719e31) 99.97%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #328   +/-   ##
=======================================
  Coverage   99.97%   99.97%           
=======================================
  Files          59       61    +2     
  Lines        6852     6885   +33     
  Branches      376      381    +5     
=======================================
+ Hits         6850     6883   +33     
  Misses          2        2           
Files Coverage Δ
src/createClient.ts 100.00% <100.00%> (ø)
src/errors/PreviewTokenExpired.ts 100.00% <100.00%> (ø)
src/errors/RepositoryNotFoundError.ts 100.00% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@angeloashmore angeloashmore changed the title fix: support expired preview token API error fix: support expired preview token and repository not found API error Oct 10, 2023
Copy link
Member

@lihbr lihbr left a comment

Choose a reason for hiding this comment

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

LGTM! This is really comprehensive 🚀

@angeloashmore angeloashmore merged commit d098a7f into master Oct 11, 2023
12 checks passed
@angeloashmore angeloashmore deleted the aa/preview-token-expired-error branch October 11, 2023 21:42
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