Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1374

Include "target" in error response caused by exceptions (ODataLibraryException, DeserializerException)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • (Java) V4 4.6.0
    • None
    • odata4-server
    • None

    Description

      Error responses should include error codes and target to enable user interfaces to tie validation errors to the related interface element.

      For example: The xml and json implementations of ODataDeserializer throw DeserializerExceptions and include the offending property in the error message. However, this information does not get propagated to the error handler.

       

      See: https://github.com/apache/olingo-odata4/blob/master/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerImpl.java#L81-L125 

      DeserializerException is converted to ODataServerError, but it is not setting the ODataServerError.target attribute. This results in error messages like:

      {"error":{"code":null,"message":"Property: Type must not be null."}}

      I would expect the error message to look like this:

      {"error":{"code": "INVALID_NULL_PROPERTY","message":"Property: Type must not be null.", target: "Type"}}

       

      As it is, I find it hard to customize error handling/validation as it is now. There is no nice way to replace ODataExceptionHelper, for example. 

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            tobias_ Tobias Niehues
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: