Project

General

Profile

Support #45110

connecteur CMIS : renvoyer un code d'erreur en fonction du type d'erreur

Added by Thomas Noël 5 months ago. Updated 4 months ago.

Status:
Nouveau
Priority:
Bas
Assignee:
-
Target version:
-
Start date:
14 Jul 2020
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

Actuellement on fait :

        except (urllib2.URLError, httplib2.HttpLib2Error) as e:
            # FIXME urllib2 still used for cmslib 0.5 compat
            raise APIError("connection error: %s" % e)
        except PermissionDeniedException as e:
            raise APIError("permission denied: %s" % e)
        except UpdateConflictException as e:
            raise APIError("update conflict: %s" % e)
        except InvalidArgumentException as e:
            raise APIError("invalid property name: %s" % e)
        except CmisException as e:
            raise APIError("cmis binding error: %s" % e)

Ce qui renvoie

{"err": 1, "err_class": "passerelle.utils.jsonresponse.APIError", "err_desc": "bla bla", ...}

et dans dans les workflow en cas d'erreur il faut interpréter le contenu de "err_desc", ce qui n'est pas forcément facile.

Ca serait mieux de renvoyer un "err" différent en fonction de l'erreur rencontrée, genre

...
        except PermissionDeniedException as e:
            raise APIError("permission denied: %s" % e, err_code=403)
        except UpdateConflictException as e:
            raise APIError("update conflict: %s" % e, err_code=409)
...

Related issues

Related to Passerelle - Development #45313: logs de cmislib inutilesRésolu (à déployer)21 Jul 2020

Actions

Associated revisions

Revision 5c489c3d (diff)
Added by Thomas Noël 4 months ago

debian: toggle cmislib logs with DEBUG (#45110)

History

#4

Updated by Thomas Noël 4 months ago

Also available in: Atom PDF