Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-73771

hudson.model.Descriptor.FormException throws away the formField

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None

      If a hudson.model.Descriptor.FormException is thrown then the resulting error shown to the user does not include the filed that caused the error.

       

      this leads to either having to duplicate the field name in the message, or a page that is mostly useless to the user as they do not know which field the error refers to.

       

      Because of this it is preferable to throw a different unchecked exception even though this is the expected exception for form binding errors, so that the details are at least present in the logs

       

      reproduction steps

      in a @DataboundConstructor throw a new FormException("can not be null", "theField")

      Attempt to create a new instance of the describable

      Expected Results

      the page displayed to the user contains the error message "can not be null" as well as a reference to the field `theField`

      Actual results

      only the message is show

      this is because the code ignores the field here

      This is also worse since https://github.com/jenkinsci/jenkins/pull/9495 as the exception no longer triggers an angry Jenkins and prints the line in the logs to correlate.

            Unassigned Unassigned
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: