fix: Return structured errors from GFAL2 storage operations #8442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New PR for #8439 which was merged too early.
Summary
exists()andgetFileMetadata()inGFAL2_StorageBasegfal2.GErrorseparately to extract thee.code(errno)ENOENTvsEACCES)See: https://gitlab.cern.ch/lhcb-dirac/LHCbDIRAC/-/merge_requests/1870
Motivation
When a storage element returns HTTP 401 (Permission Denied / Authentication Error),
dirac-dms-check-fc2seincorrectly reports files as "missing at SEs". This is because all files inmetadata["Failed"]are treated as "not existing" regardless of the actual error type.By returning structured error information with errno codes, downstream code can properly handle permission denied errors separately from file-not-found errors, avoiding false positives.
Changes
The error format changes from:
to:
Backward Compatibility
Downstream code should handle both the old string format and new dict format during the transition period:
BEGINRELEASENOTES
*DataManagement
CHANGE: Expose type of error from GFAL2_StorageBase.getFileMetadata
ENDRELEASENOTES