Improve error message for Graphql API (#7805)

![CleanShot 2024-10-17 at 11 39
39](https://github.com/user-attachments/assets/616b8317-de1f-4b61-b2b4-980b14b09f66)

This improves this error message.

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Thibault Le Ouay
2024-10-17 22:40:30 +02:00
committed by GitHub
parent a45d3148ac
commit 249c7324a2

View File

@ -15,7 +15,9 @@ export const AuthUser = createParamDecorator(
const request = getRequest(ctx); const request = getRequest(ctx);
if (!options?.allowUndefined && !request.user) { 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.",
);
} }
return request.user; return request.user;