Gitlab project not found: return a ProjectNotFoundError
Created by: mollylogue
Context:
- We have a background task in Cloud that iterates over all repos associated w/ a cloud_default external service (i.e. only synced on demand) and a non-empty
last_error
field and callssyncer.SyncRepo()
for each of these repos. ThatSyncRepo
function checks here if the error returned is a particular type of error or not. Currently none of the errors returned from Gitlab match that type, so this code updates that code to return the correct error. - I personally prefer this method (returning the
ProjectNotFoundError
rather than anHTTPError
) because it's what we do with Github and it seems way cleaner. If others are worried about making this change to the error being returned, there is the possibility of handling an http error returned byRepoStore.GetByName
in the syncer instead. I just personally prefer to keep consistency across different sources.
Test plan
Updated/added unit tests to reflect this behavior. Will also test once more in my local deployment before merging.
Closes https://github.com/sourcegraph/security-issues/issues/210