konnectors/cozy-konnector-cesu

Handle received messages

Opened this issue · 2 comments

The main interaction with the CESU website is through a call to "/bulletinsSalaire" which returns JSON-formatted information.

This return object does seem to have messages in it which could be handled - either displayed to the end user, or at least sent in the logs for later analysis or understanding.

Ex of a result:

{
  "listeMessages" : [ {
    "codeInterne" : 31,
    "contenu" : "La date de recherche doit être comprise dans les 5 dernières années",
    "log" : null
  } ],
  "hasMessage" : true,
  "hasMsgAvert" : false,
  "hasMsgErrFonc" : true,
  "hasMsgErrTech" : false,
  "hasMsgInfo" : false,
  "listeObjets" : [ ]
}

Based on their name and a guess of their usage,, we could also use the "has*" properties to decide how to present the output:

  • hasMsgAvert -> Avertissement -> Warning in the logs
  • hasMsgErrFonc -> Erreur Fonctionnelle -> Logic error, user error (Display to user + logs)
  • hasMsgErrTech -> Erreur Technique -> Technical error, unexpected error (Display to user + logs)
  • hasMsgInfo -> Information -> Info in the logs

(spinoff of #159)

@llange You are totally right. Do you want to propose a PR for this (with the logs)?
Or else I can do it.

@doubleface if you're not in a hurry about it, I can try to propose a PR - but be warned that it will certainly take weeks (or more) - based on my (lack of) free time.
Otherwise, feel free to do it.