api_entreprise: standardize error handling (#72961)
This commit is contained in:
parent
56dd83c347
commit
a1600961af
|
@ -120,10 +120,12 @@ class APIEntreprise(BaseResource):
|
|||
)
|
||||
if response.status_code != 200:
|
||||
if data.get('error') == 'not_found':
|
||||
return {
|
||||
'err': 1,
|
||||
'err_desc': data.get('message', 'not-found'),
|
||||
}
|
||||
raise APIError(
|
||||
data.get('message', 'not-found'),
|
||||
data={
|
||||
'status_code': response.status_code,
|
||||
},
|
||||
)
|
||||
raise APIError(
|
||||
'API-entreprise returned a non 200 status %s: %s' % (response.status_code, data),
|
||||
data={
|
||||
|
|
Loading…
Reference in New Issue