• Iustin Pop's avatar
    RAPI: format error messages as JSON · 1f8588f6
    Iustin Pop authored
    This patch changes the format of the HTTP error messages from text/html, which
    is hard to parse from RAPI clients, to JSON which can be automatically parsed.
    
    The error message is an object, which contains always three keys:
      - code, an integer with the error code
      - message, a short description
      - explain, holding (if available) a description of the error
    
    In order to implement this, there is a bit of change to the http server
    and executor classes. I've tested and the error handling still works
    (but less optimal, no error message) in case the error formatting itself
    raises an exception.
    
    Reviewed-by: imsnah
    1f8588f6
server.py 16.2 KB