Skip to content

Commit

Permalink
fix except handling in get_aggregated_resources
Browse files Browse the repository at this point in the history
Avoids UnboundLocalError: local variable 'detected_resource' referenced before assignment if raise_on_error is True
  • Loading branch information
munagekar authored Feb 17, 2022
1 parent ec3053e commit 76b000d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ def get_aggregated_resources(
# pylint: disable=broad-except
except Exception as ex:
if detector.raise_on_error:
detected_resource = _EMPTY_RESOURCE
raise ex
logger.warning(
"Exception %s in detector %s, ignoring", ex, detector
)
detected_resource = _EMPTY_RESOURCE
finally:
detectors_merged_resource = detectors_merged_resource.merge(
detected_resource
Expand Down

0 comments on commit 76b000d

Please sign in to comment.