Handle 403 (Forbidden) errors gracefully
If a user is not allowed to access a resource, an HTTP 403 (Forbidden) error is returned by Gitlab's API.
At the moment, we don't handle those errors, resulting in tap-gitlab stopping its execution when trying to access a forbidden resource. Example provided in dbt-tap-gitlab#4 (closed):
... ... ...
INFO GET https://gitlab.com/api/v4/projects/XXXXX/merge_requests?scope=all
CRITICAL Error making request to GitLab API: GET https://gitlab.com/api/v4/projects/14707715/merge_requests?scope=all
[403 - b'{"message":"403 Forbidden"}']
... ... ...
This is important when accessing all the projects under a group as some of those projects may be private and not available to the user. This is also important for allowing a user without elevated privileges to at least partially fetch some of the entities available to them (e.g. fetch issues and MRs while failing to fetch members)
We should handle those errors gracefully:
- Skip the extraction of entities that you get a 403 (Forbidden) error for
- Continue with the rest of the extraction process
- Inform the user about the Entities we did not fetch cause they had no access to them
Edited by Yannis Roussos