Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-26878

While creating documents, catch validation errors returned by the server-side validation process with HTTP code 400

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 10.10
    • Fix Version/s: None
    • Component/s: Web UI

      Description

      Why do we need it?

      As a user, I want to create a document which type as resolvers, maybe custom resolvers. When the validation process fails server side, it returns a 400 error with a JSON message as:

      {
         "entity-type":"validation_report",
         "has_error":true,
         "number":1,
         "violations":[
            {
               "message":"The field very_restricted field must be unique accross the platform",
               "invalid_value":"my_invalidValue",
               "constraint":{
                  "entity-type":"validation_constraint",
                  "name":"myCustomResolver",
                  "parameters":{
                     "validation":"true"
                  }
               },
               "path":[
                  {
                     "field_name":"my_schema:very_restricted",
                     "is_list_item":false
                  }
               ]
            }
         ]
      }
      

      Currently, the nuxeo-document-create layout wrapper only catches error without a specific error code and shows a generic error message in the _create function

      .catch(function(err) {
                this.set('creating', false);
                this.fire('notify', {message: this.i18n('documentCreationForm.createError')});
                console.error(err);
              }
      

      What do we expect?

      We need to manage the 400 error and display all violations.message if it has has_error=true in the toast component

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: