pypac icon indicating copy to clipboard operation
pypac copied to clipboard

When get_pac returns None, there is no way to tell if there is no PAC, or if error occurred

Open KarelChanivecky opened this issue 11 months ago • 3 comments

In download_pac, when an error occurs during an HTTP request, the error is ignored, and the next URL is attempted. At the end, if all URLs failed with error, the function returns None. It can be implied from this function that an error has occurred. If the list of URLs contained at least one URL, it should be expected that a response is available. However, it cannot be implied from get_pac, as perhaps PAC is not configured at all. Hence, either:

  • get_pac raises an error if PAC is not configured (This way the user can imply whether to expect a PAC)
  • get_pac evaluates if a PAC script was expected and raises an error otherwise
  • download_pac collects all the errors that occured, and chooses one to raise
  • download_pac collects all the errors and throws a new error type that contains the list of errors that occurred. (Leave it up to the user to figure out what error he cares about)

KarelChanivecky avatar Aug 02 '23 18:08 KarelChanivecky