prismicio / prismic-client

The official JavaScript + TypeScript client library for Prismic
https://prismic.io/docs/technical-reference/prismicio-client
Apache License 2.0
169 stars 61 forks source link

fix: support expired preview token and repository not found API error #328

Closed angeloashmore closed 1 year ago

angeloashmore commented 1 year ago

Types of changes

Description

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

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

Checklist:

🐤

codecov-commenter commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

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

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

Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/prismicio/prismic-client/pull/328?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=prismicio) | Coverage Δ | | |---|---|---| | [src/createClient.ts](https://app.codecov.io/gh/prismicio/prismic-client/pull/328?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=prismicio#diff-c3JjL2NyZWF0ZUNsaWVudC50cw==) | `100.00% <100.00%> (ø)` | | | [src/errors/PreviewTokenExpired.ts](https://app.codecov.io/gh/prismicio/prismic-client/pull/328?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=prismicio#diff-c3JjL2Vycm9ycy9QcmV2aWV3VG9rZW5FeHBpcmVkLnRz) | `100.00% <100.00%> (ø)` | | | [src/errors/RepositoryNotFoundError.ts](https://app.codecov.io/gh/prismicio/prismic-client/pull/328?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=prismicio#diff-c3JjL2Vycm9ycy9SZXBvc2l0b3J5Tm90Rm91bmRFcnJvci50cw==) | `100.00% <100.00%> (ø)` | | | [src/index.ts](https://app.codecov.io/gh/prismicio/prismic-client/pull/328?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=prismicio#diff-c3JjL2luZGV4LnRz) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.