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

feat(adapter): take away error handling from adapters #1871

Merged
merged 13 commits into from
May 5, 2021

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Apr 27, 2021

Reasoning 💡

What changes are being made? What feature/bug is being fixed here?

Checklist 🧢

Feel free cross items ( like this ~[] item~ ) if they're irrelevant to your changes.

To check an item, place an x in the box like so: - [x] Documentation.

  • Documentation
  • Tests
  • Ready to be merged
  • add debugging

Affected issues 🎟

#1832

@vercel
Copy link

vercel bot commented Apr 27, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/3wcqomtEk3nVnTTJhRoKDky8WLP8
✅ Preview: https://next-auth-git-feat-move-adapter-responsibility-nextauthjs.vercel.app

@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters core Refers to `@auth/core` labels Apr 27, 2021
@vercel vercel bot temporarily deployed to Preview April 30, 2021 17:16 Inactive
@vercel vercel bot temporarily deployed to Preview April 30, 2021 17:23 Inactive
@vercel vercel bot temporarily deployed to Preview April 30, 2021 18:15 Inactive
package.json Outdated Show resolved Hide resolved
const adapterMethod = adapter[method]
acc[method] = async (...args) => {
try {
return await adapterMethod(...args)
Copy link
Member Author

Choose a reason for hiding this comment

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

should log out args with debug, and an adapter prefix(?)

@kripod, currently logger.debug is rewritten in adapters to include a prefix for code. Do you think we could return a name property next to getAdapter for this purpose?

any thoughts?

Copy link
Contributor

@kripod kripod Apr 30, 2021

Choose a reason for hiding this comment

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

We may specify an attribute like { displayName: string } as the minimum required config param when instantiating adapters. By doing so, we would also solve the typing issue of Adapter(requiredParam, …).

Copy link
Member Author

Choose a reason for hiding this comment

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

After my recent commit, it will be possible for adapters to return a displayName property in getAdapter. Unfortunately we don't have the adapter configuration when we invoke the .getAdapter() method.

@vercel vercel bot temporarily deployed to Preview May 1, 2021 10:52 Inactive
@vercel vercel bot temporarily deployed to Preview May 1, 2021 10:53 Inactive
@vercel vercel bot temporarily deployed to Preview May 1, 2021 10:55 Inactive
@balazsorban44 balazsorban44 force-pushed the feat/move-adapter-responsibility branch from 4572912 to 3524264 Compare May 1, 2021 10:56
@vercel vercel bot temporarily deployed to Preview May 1, 2021 10:56 Inactive
@vercel vercel bot temporarily deployed to Preview May 1, 2021 11:04 Inactive
@github-actions github-actions bot added the TypeScript Issues relating to TypeScript label May 1, 2021
@vercel vercel bot temporarily deployed to Preview May 1, 2021 11:07 Inactive
@balazsorban44 balazsorban44 marked this pull request as ready for review May 3, 2021 20:38
@balazsorban44 balazsorban44 requested a review from ubbe-xyz as a code owner May 3, 2021 20:38
@balazsorban44
Copy link
Member Author

Currently waiting for @kripod and his results after testing these changes in production. We expect fewer unhandled errors.

@vercel vercel bot temporarily deployed to Preview May 3, 2021 22:16 Inactive
@vercel vercel bot temporarily deployed to Preview May 3, 2021 23:01 Inactive
@vercel vercel bot temporarily deployed to Preview May 5, 2021 17:35 Inactive
@balazsorban44 balazsorban44 changed the title feat(adapter): take away error handling from adapter feat(adapter): take away error handling from adapters May 5, 2021
@balazsorban44 balazsorban44 merged commit 86baefd into main May 5, 2021
@balazsorban44 balazsorban44 deleted the feat/move-adapter-responsibility branch May 5, 2021 17:45
mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters core Refers to `@auth/core` TypeScript Issues relating to TypeScript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants