GoogleCloudPlatform / datacatalog-connectors-bi

Sample code with integration between Data Catalog and BI data sources.
Apache License 2.0
32 stars 16 forks source link

Improve the exception handling #66

Closed ricardolsmendes closed 3 years ago

ricardolsmendes commented 3 years ago

- What I did Changed scrape.BaseEngineAPIHelper._run_until_complete() in order to cancel all tasks running in a given event loop regardless of the type of the exception type that might be raised during the asynchronous code execution.

- How I did it The main change consists of replacing except asyncio.TimeoutError: with except Exception: in the aforementioned method. All other changes are consequences of it.

Please notice timeouts are now logged and bypassed at the child-class level. Other exceptions are raised, as they used to be before the changes.

if isinstance(e, asyncio.TimeoutError):
    return []
else:
    raise

- How to verify it Run the unit tests and preferably the connector in an integrated environment.

- Description for the changelog Improved the exception handling mechanism in order to cancel all tasks running in a given event loop regardless of the type of the exception type that might be raised during the asynchronous code execution.