@@ -116,7 +116,7 @@ def __init__(
116116 try :
117117 self .github_app_id : int | None = int (raw_github_app_id )
118118 except (TypeError , ValueError ) as exc :
119- raise AirflowException (
119+ raise ValueError (
120120 f"Invalid 'github_app_id' value { raw_github_app_id !r} . It must be an integer."
121121 ) from exc
122122 else :
@@ -127,7 +127,7 @@ def __init__(
127127 try :
128128 self .github_installation_id : int | None = int (raw_github_installation_id )
129129 except (TypeError , ValueError ) as exc :
130- raise AirflowException (
130+ raise ValueError (
131131 f"Invalid 'github_installation_id' value { raw_github_installation_id !r} . It must be an integer."
132132 ) from exc
133133 else :
@@ -139,24 +139,23 @@ def __init__(
139139 if (self .github_app_id and not self .github_installation_id ) or (
140140 not self .github_app_id and self .github_installation_id
141141 ):
142- raise AirflowException (
142+ raise ValueError (
143143 "Both 'github_app_id' and 'github_installation_id' must be provided to use GitHub App Authentication"
144144 )
145145 if self .github_app_id and self .github_installation_id :
146146 if not self .key_file and not self .private_key :
147- raise AirflowException ("Missing inline private_key or key_file for GitHub App Auth" )
147+ raise ValueError ("Missing inline private_key or key_file for GitHub App Auth" )
148148 if self .key_file and not self .private_key :
149149 try :
150150 with open (self .key_file , encoding = "utf-8" ) as key_file :
151151 self .private_key = key_file .read ()
152152 except OSError as exc :
153- raise AirflowException (
153+ raise OSError (
154154 f"Failed to read GitHub App private key file { self .key_file !r} : { exc } "
155155 ) from exc
156156 if not (self .repo_url or "" ).startswith (("https://" , "http://" )):
157- raise AirflowException (
158- "GitHub App authentication requires an HTTPS repository URL, "
159- f"but got: { self .repo_url !r} "
157+ raise ValueError (
158+ f"GitHub App authentication requires an HTTPS repository URL, but got: { self .repo_url !r} "
160159 )
161160 # Store the PEM separately so configure_hook_env() does not treat it as an SSH key.
162161 self .github_app_private_key : str | None = self .private_key
@@ -203,7 +202,7 @@ def _get_github_app_token(self):
203202 try :
204203 from github import Auth as GithubAuth , Github as GithubClient
205204 except ImportError as exc :
206- raise AirflowException (
205+ raise ImportError (
207206 "The PyGithub library is required for GitHub App authentication. Please install it with 'pip install apache-airflow-providers-git[github]'"
208207 ) from exc
209208
0 commit comments