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

Specific error type mapping in isDirectusError function #22346

Merged
merged 4 commits into from May 3, 2024

Conversation

paescuj
Copy link
Member

@paescuj paescuj commented Apr 30, 2024

Scope

Extend isDirectusError guard function to return specific error type when code for built-in error is provided

Before

After

Potential Risks / Drawbacks

If a custom error would use same error code as a built-in error, the type could vary. However, this is a) not recommended and b) a matching custom type could still be passed in as generic param.

Review Notes / Questions

None

Copy link

changeset-bot bot commented Apr 30, 2024

🦋 Changeset detected

Latest commit: c5d8dc3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@directus/errors Minor
@directus/api Patch
@directus/extensions-registry Patch
@directus/memory Patch
@directus/validation Patch
directus Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@br41nslug br41nslug left a comment

Choose a reason for hiding this comment

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

Couple of small typing ideas

packages/errors/src/types.ts Outdated Show resolved Hide resolved
packages/errors/src/types.ts Outdated Show resolved Hide resolved
Co-authored-by: Brainslug <[email protected]>
Copy link
Contributor

@hanneskuettner hanneskuettner left a comment

Choose a reason for hiding this comment

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

Nice improvement ❤️

@hanneskuettner hanneskuettner merged commit ae9c641 into main May 3, 2024
4 checks passed
@hanneskuettner hanneskuettner deleted the directus-error-type-map branch May 3, 2024 07:53
@github-actions github-actions bot added this to the Next Release milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants