Skip to content

fix(remix,nextjs,clerk-react): Export EmailLinkErrorCode from /errors#2732

Merged
nikosdouvlis merged 1 commit into
mainfrom
nikos/remix-v5-errors
Feb 6, 2024
Merged

fix(remix,nextjs,clerk-react): Export EmailLinkErrorCode from /errors#2732
nikosdouvlis merged 1 commit into
mainfrom
nikos/remix-v5-errors

Conversation

@nikosdouvlis

Copy link
Copy Markdown
Member

Description

  • Re-introduce EmailLinkErrorCode
  • Introduce /errors top-level module for the clerk/remix package
  • Add /errors, ssr.server/ and api.server/ directories containing package.json files so IDEs can properly suggest import paths for clerk/remix

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

@changeset-bot

changeset-bot Bot commented Feb 6, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 84d7149

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

This PR includes changesets to release 6 packages
Name Type
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
gatsby-plugin-clerk 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

@nikosdouvlis nikosdouvlis force-pushed the nikos/remix-v5-errors branch from c06924e to 84d7149 Compare February 6, 2024 12:05

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.

🙃 Wdyt about introducing a different structure to support subpath errors and error messages? Eg

// remix/src/errors/index.ts
export {
  isClerkAPIResponseError,
  isEmailLinkError,
  isKnownError,
  isMetamaskError,
  EmailLinkErrorCode,
} from '@clerk/clerk-react/errors';

// remix/src/errors/messages.ts
const createErrorMessage = (msg: string) => {
// ...
}
// ... all the error messages that are being moved to utils/errors with this PR

I would prefer if we kept all the errors in the same place and avoid adding them to utils "bucket".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Definitely, but we cannot do this using a single errors.ts as this is the top-level entry file for the publicly available errors.

This PR changes the top-level API. I will open follow-up PR that aligns the strategy used in clerk/remix with the other packages as well.

Having a internalErrors could be enough, or we could always have a ./errors/ containing internal error utils and a ./errors.ts top level entry point for the public APIs

import { noSecretKeyError, satelliteAndMissingProxyUrlAndDomain, satelliteAndMissingSignInUrl } from '../errors';
import { getEnvVariable } from '../utils';
import { noSecretKeyError, satelliteAndMissingProxyUrlAndDomain, satelliteAndMissingSignInUrl } from '../utils/errors';
import { getEnvVariable } from '../utils/utils';

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.

😓 this seems kind of weird, that's why i suggested the errors restructuring.

@nikosdouvlis nikosdouvlis merged commit ee57f21 into main Feb 6, 2024
@nikosdouvlis nikosdouvlis deleted the nikos/remix-v5-errors branch February 6, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants