-
W. Trevor King authored
The old implementation had several instances of logic like this: if exception_condition: self.logerr("invalid request") else: # continue_processing This increases nesting after each round of exception checking, and makes the logic of the whole function harder to follow. This commit replaces that logic with: try: if exception_condition: raise InvalidRequest("invalid request") # continue peocessing except InvalidRequest, e: self.logerr(str(e)) Because the guts of the handle() function are already inside a try/except block, we can add our except clause to the existing block, and now exception checks don't increase nesting at all. The exception to this global try/except block is the 'URL has unexpected type' error, where we do want a local try/except block inside the channel loop. That way we get both errors about invalid URLs and continue to attempt valid URLs. This matches the existing logic for this check, but conflicts with the current target.valid check (which doesn't log an error and does stop processing of further channels).
W. Trevor King authoredThe old implementation had several instances of logic like this: if exception_condition: self.logerr("invalid request") else: # continue_processing This increases nesting after each round of exception checking, and makes the logic of the whole function harder to follow. This commit replaces that logic with: try: if exception_condition: raise InvalidRequest("invalid request") # continue peocessing except InvalidRequest, e: self.logerr(str(e)) Because the guts of the handle() function are already inside a try/except block, we can add our except clause to the existing block, and now exception checks don't increase nesting at all. The exception to this global try/except block is the 'URL has unexpected type' error, where we do want a local try/except block inside the channel loop. That way we get both errors about invalid URLs and continue to attempt valid URLs. This matches the existing logic for this check, but conflicts with the current target.valid check (which doesn't log an error and does stop processing of further channels).
Code owners
Assign users and groups as approvers for specific file changes. Learn more.