microsoft / m365-compliance-connector-sample-scripts

MIT License
8 stars 7 forks source link

Throw an exception for general errors so that the metadata file isn't updated #4

Closed ketanmadasuMS closed 2 years ago

ketanmadasuMS commented 2 years ago

This PR fixes Bug #2618658. When the connector script fails to upload a file, only HTTP 501 and 503 errors (sever errors) are handled by the script currently by raising exceptions.

Any other error will go into the next block, which only logs the error but does not raise any exceptions using the throw keyword.

The retry function therefore assumes the upload succeeded and updates the meta-data file with "X Lines Uploaded". Therefore, the user sees an error logged but on retry, the script assumes the file was already successfully sent.

Fix:

Added a throw statement in the block so that retry works as expected. Also added a retryTimeout parameter so testing becomes a little bit easier.