salesforce-marketingcloud / FuelSDK-Python

FuelSDK for python
Other
127 stars 191 forks source link

Improve error handling #123

Open mourtisma opened 4 years ago

mourtisma commented 4 years ago

Referenced Issue: #122

This PR tackles the following code improvements

  1. When configuring the ET_Client, loading the WSDL and refreshing the token, the current code only raise base Exceptions, which are not ideal to handle for developers => Create a base class for exceptions raised by the ET_Client, and subclasses for the different scenarios (configuration, loading WSDL, token refresh)

  2. Potential HTTP errors coming from requests are not properly handled => Use Response.raise_for_status to handle HTTP error responses coming from requests

  3. In the ET_Client params, applicationType, if not None or blank, can be anything => Handle that case properly, and raise a new ConfigurationException in case of unallowed value

I also added tests for these error scenarios, in a specific file, FuelSDK/test_ET_Client_errors.py

mourtisma commented 4 years ago

@smunuswami @manivinesh

Hi everyone!

If you don't have time to look at this PR, feel free to ask someone else to do so.

I chose you two because you were my two first reviewer suggestions.

Thanks!

mourtisma commented 4 years ago

@smunuswami @manivinesh Hi everyone. This PR has been opened for months, now.

Can someone please have a look (or suggest someone who could) at it ? Thank you :)