Add error handling for inline blame GraphQL query
What does this MR do?
Adds error handling to the inline blame GraphQL query used in two components:
simple_viewer.vue
source_viewer.vue
Previously, if the blame query failed, it would fail silently without any user feedback. Now users see a clear error message when the blame information cannot be loaded.
Issue: #568003
Changes
- Added try-catch blocks around the blame GraphQL query in both components
- Display flash message "Failed to load blame information" when query fails
- Added test coverage for error scenarios
- Uses GitLab's standard
createAlert
Testing Steps
Manual Testing
- Enable
inline_blame
feature flag - Navigate to any file in the repository
- Click the "Blame" button to enable blame view
-
To test error handling:
- Open browser dev tools → Network tab
- Enable "Offline" mode or block GraphQL requests or add
ignore_revs=true
param if ignore revs file not available - Click "Blame" button again
- Verify that a flash message appears: "Failed to load blame information"
- Disable offline mode and verify blame works normally again
Screenshots
Edited by Jacques Erasmus