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

Improve error message for Graphql API #7805

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Conversation

thibaultleouay
Copy link
Contributor

CleanShot 2024-10-17 at 11 39 39

This improves this error message.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This pull request enhances the error message in the AuthUser decorator to provide clearer context about authentication requirements.

  • Modified packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts to improve error clarity
  • Updated ForbiddenException message to explicitly state that the endpoint requires a user, not just an API key
  • Enhanced developer experience by providing more specific authentication requirement information

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -15,7 +15,7 @@ export const AuthUser = createParamDecorator(
const request = getRequest(ctx);

if (!options?.allowUndefined && !request.user) {
throw new ForbiddenException("You're not authorized to do this");
throw new ForbiddenException("You're not authorized to do this. Note: This endpoint requires a user and won't work with just an API key.");
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider breaking this long string into multiple lines for better readability

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

Good idea :) Thank you

@charlesBochet
Copy link
Member

@thibaultleouay You have lint issues, could you fix those (npx nx run twenty-server:lint:ci to detect them locally)

You have created a branch from your main branch so I cannot commit to your branch to help you

@thibaultleouay
Copy link
Contributor Author

@charlesBochet with gh cli you can do
gh pr checkout 7805

@charlesBochet
Copy link
Member

7805

I've learned something!

@charlesBochet charlesBochet merged commit 249c732 into twentyhq:main Oct 17, 2024
6 checks passed
@charlesBochet
Copy link
Member

/award 150

Copy link

oss-gg bot commented Oct 17, 2024

Awarding thibaultleouay: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/thibaultleouay

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