Skip to content

Commit

Permalink
fix for review
Browse files Browse the repository at this point in the history
  • Loading branch information
TakayukiTanabeSS committed Jan 16, 2025
1 parent 742d219 commit 9c83c8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions providers/src/airflow/providers/http/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
from airflow.exceptions import AirflowException


class HttpErrorException(AirflowException):
"""Exception raised for HTTP error in Http hook."""

class HttpMethodException(AirflowException):
"""Exception raised for invalid HTTP methods in Http hook."""
6 changes: 2 additions & 4 deletions providers/src/airflow/providers/http/hooks/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook
from airflow.providers.http.exceptions import HttpMethodException
from airflow.providers.http.exceptions import HttpErrorException, HttpMethodException

if TYPE_CHECKING:
from aiohttp.client_reqrep import ClientResponse
Expand Down Expand Up @@ -452,9 +452,7 @@ async def run(
self.log.exception("HTTP error with status: %s", e.status)
# In this case, the user probably made a mistake.
# Don't retry.
raise AirflowException(f"{e.status}:{e.message}")
else:
await asyncio.sleep(self.retry_delay)
raise HttpErrorException(f"{e.status}:{e.message}")
else:
return response

Expand Down

0 comments on commit 9c83c8a

Please sign in to comment.