Fury0508 opened a new pull request, #61389:
URL: https://github.com/apache/airflow/pull/61389

   # Add error handling for pause/unpause toggle permission errors
   
   ## Description
   
   When a user without `dag.can_edit` permission attempts to pause or unpause a 
DAG, the UI currently fails silently - the toggle doesn't change and no error 
message is displayed, even though the server returns a 403 error. This creates 
a confusing user experience.
   
   This PR adds proper error handling to the pause/unpause toggle:
   - Displays a toast notification when the operation fails
   - Shows the error message from the server (including 403 permission errors)
   - Follows the existing error handling pattern used in other mutations (e.g., 
`useTrigger`)
   
   ## Changes Made
   
   - Added error handling callback (`onError`) to `useTogglePause` hook
   - Imported `toaster` component and `useTranslation` hook
   - Display error toast with translated title and server error message
   
   ## Testing
   
   - Linting and TypeScript compilation passes
   - Follows the same pattern as `useTrigger.ts` which has proven error handling
   
   closes: #61363
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude (Anthropic) was used to help locate the relevant code 
files and understand the error handling patterns in the codebase. The actual 
fix was implemented independently by following the established patterns found 
in similar files like `useTrigger.ts`.
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information.
   * In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.


-- 
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