Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Raise specific exception for bad auth. #155

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dHannasch
Copy link

@dHannasch dHannasch commented Mar 13, 2021

I'm picturing something like this to give a more informative error message in the case of bad auth. Thoughts?

@jasonrollins
Copy link
Owner

I see what you're doing there. That looks good. I think we can just keep it in the getuser function since we know it will get called on initialization. You don't need to replace the post() function, its a wrapper for self._session.post(). Can you confirm that this gives the appropriate error on SharePoint 2016?

@dHannasch
Copy link
Author

I had to replace the post() function because the wrapper immediately raises an exception on a 404. In this case, to confirm that it's actually a permission error (rather than the URL not being found, as you would normally interpret a 404), we want to first check that posting to the URL normally receives a 200 OK.

With this merged into the gitlab-ci-yml branch, this is now the error that gets raised when I try to run the tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants