Closed yeti9990 closed 9 months ago
Ensure exceptions are properly bubbled. A user should NOT have to write nested exception code like so:
def get_all_zones(view: str) -> list: try: res = wapi.get('zone_auth', {'view': view}) except WapiRequestException as err: log.error(err) sys.exit(1) else: if res.status_code != 200: log.error(res.text) sys.exit(1) return res.json()
Our code is passing things along, and it needs to do a better job of checking requests.exceptions vs WAPI exceptions so we can code as follows:
def get_all_zones(view: str) -> list: try: res = wapi.get('zone_auth', {'view': view}) except WapiRequestException as err: log.error(err) sys.exit(1) return res.json()
Ensure exceptions are properly bubbled. A user should NOT have to write nested exception code like so:
Our code is passing things along, and it needs to do a better job of checking requests.exceptions vs WAPI exceptions so we can code as follows: