potiuk edited a comment on pull request #21540:
URL: https://github.com/apache/airflow/pull/21540#issuecomment-1040863702


   > It looks like the exception that's happening during the handling of the 
first exception is actually Airflow filtering code (the secret masker 
specifically):
   > 
   > ```
   >     exception.args = (self.redact(v) for v in exception.args)
   > [2022-02-12, 09:27:16 UTC] {logging_mixin.py:115} WARNING - 
AttributeError: can't set attribute
   > ```
   > 
   > I think this code should be patched to handle whatever edge case is 
occurring here, rather than the caller just catching the exception and logging 
it another way to work around it.
   > 
   > It looks like @potiuk was the last to touch the 
`_redact_exception_with_context` method, perhaps he has more context.
   
   Yeah. I refectored a code that had literally this comment:
   
   >    # I'm not sure if this is a good idea!
   
   Apparently it was not.
   
   I think the right approach is to make the same try/except but in the place 
where redact is mdone @hubert-pietron
   
   Just find:
   ```
           exception.args = (self.redact(v) for v in exception.args)
   ```
   
   and surround it with the:
   
   ```
   try:
           exception.args = (self.redact(v) for v in exception.args)
   except AttributeError:
          pass
   ```
   
   The problem is that in some exceptions the args are "read property" and you 
cannot replace them.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to