mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
[AAP-68258] Fix SonarCloud Reliability Rating issue in Common exception constructor (#16351)
Fix SonarCloud Reliability Rating issue in Common exception constructor The constructor had code paths where attributes were not consistently initialized and super().__init__() was not called, which was flagged as a Reliability Rating issue by SonarCloud. Ensures all branches properly set self.status_string and self.msg, and call super().__init__(). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
63f3c735ea
commit
8bd8bcda94
@@ -2,9 +2,12 @@ class Common(Exception):
|
||||
def __init__(self, status_string='', message=''):
|
||||
if isinstance(status_string, Exception):
|
||||
self.status_string = ''
|
||||
return super(Common, self).__init__(*status_string)
|
||||
self.status_string = status_string
|
||||
self.msg = message
|
||||
self.msg = message
|
||||
super().__init__(*status_string.args)
|
||||
else:
|
||||
self.status_string = status_string
|
||||
self.msg = message
|
||||
super().__init__(status_string, message)
|
||||
|
||||
def __getitem__(self, val):
|
||||
return (self.status_string, self.msg)[val]
|
||||
|
||||
Reference in New Issue
Block a user