shareplum icon indicating copy to clipboard operation
shareplum copied to clipboard

Raise specific exception for bad auth.

Open dHannasch opened this issue 4 years ago • 2 comments

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

dHannasch avatar Mar 13 '21 03:03 dHannasch

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?

jasonrollins avatar Mar 13 '21 15:03 jasonrollins

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.

dHannasch avatar Mar 13 '21 15:03 dHannasch