Skip to content

Conversation

@allison-truhlar
Copy link
Collaborator

@allison-truhlar allison-truhlar commented Jan 6, 2026

Clickup id: 86ae98yg2

This PR adds error handling for user context configuration issues related to access flags and server privileges. It also adds a global error handler for permission errors, to handle any future cases where permission errors are not otherwise caught.

Addresses this comment in PR #283

@krokicki

-inherits from PermissionError
-created to distinguish this specific configuration error from other PermissionErrors
- not catching PermissionErrors was what was originally causing no JSON response to be returned from the server when setegid, setgroups, or seteuid failed. Even those these specific errors are not caught by the custom error class and handler, I left in the global PermissionError handler to catch other instances where a PermissionError might not be caught in a specific method
- catch PermissionErrors in EffectiveUserContext.__enter__() and raise the new custom error class instead
Copy link
Member

@krokicki krokicki left a comment

Choose a reason for hiding this comment

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

LGTM

@krokicki
Copy link
Member

krokicki commented Jan 6, 2026

Actually, I wonder if PermissionError can happen for any other reasons. Are we sure it's only possible when the server is misconfigured?

@allison-truhlar
Copy link
Collaborator Author

Actually, I wonder if PermissionError can happen for any other reasons. Are we sure it's only possible when the server is misconfigured?

I added a check before raising the custom error. If use_access_flags is false, then the PermissionError is raised as-is.

The error message was replicated in three places. Doing this means we
can set it once but still override it if needed.
Copy link
Member

@neomorphic neomorphic left a comment

Choose a reason for hiding this comment

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

LGTM! I refactored the error message into the UserContextConfigurationError class so it doesn't need to be written three times.

@allison-truhlar allison-truhlar merged commit 2874ca6 into mkitti-handle-internal-server-errors-file-queries Jan 6, 2026
3 checks passed
@allison-truhlar allison-truhlar deleted the fix-server-response-for-user-context-error branch January 6, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants