Skip to content

Commit

Permalink
enh(amazon_hook): raise not found exception instead of general except…
Browse files Browse the repository at this point in the history
…ion when download file (#39509)
  • Loading branch information
keygrocery authored May 11, 2024
1 parent 2b1a2f8 commit ca058a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions airflow/providers/amazon/aws/hooks/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from boto3.s3.transfer import S3Transfer, TransferConfig
from botocore.exceptions import ClientError

from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
from airflow.exceptions import AirflowException, AirflowNotFoundException, AirflowProviderDeprecationWarning
from airflow.providers.amazon.aws.exceptions import S3HookUriParseFailure
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
from airflow.providers.amazon.aws.utils.tags import format_tags
Expand Down Expand Up @@ -1390,7 +1390,7 @@ def download_file(
s3_obj = self.get_key(key, bucket_name)
except ClientError as e:
if e.response.get("Error", {}).get("Code") == 404:
raise AirflowException(
raise AirflowNotFoundException(
f"The source file in Bucket {bucket_name} with path {key} does not exist"
)
else:
Expand Down

0 comments on commit ca058a6

Please sign in to comment.