While trying to test whether a given SonarQube project already has alm settings, I'm currently doing:
c = sonarqube.SonarEnterpriseClient(sonarqube_url=sonarqube_address, token=sonarqube_api_token)
binding = c.alm_settings.get_binding(sonarqube_project_key)
When there is no alm settings defined at the project, get_binding raises a generic sonarqube.utils.exceptions.ClientError with the message Error in request. Possibly client error [404]: Project 'xxx' is not bound to any ALM.
But there is no straightforward way to deal with this expected error without looking at the exception message for Possibly client error [404].
Can we have a better way of reporting a 404?
For example, maybe with a class named NotFoundClientError?
Also, maybe add a response_code property to the ClientError class too?
While trying to test whether a given SonarQube project already has alm settings, I'm currently doing:
When there is no alm settings defined at the project,
get_binding
raises a genericsonarqube.utils.exceptions.ClientError
with the messageError in request. Possibly client error [404]: Project 'xxx' is not bound to any ALM
.But there is no straightforward way to deal with this expected error without looking at the exception message for
Possibly client error [404]
.Can we have a better way of reporting a 404?
For example, maybe with a class named
NotFoundClientError
?Also, maybe add a
response_code
property to theClientError
class too?