Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-13900

Allow exceptions to be thrown from workflow scripts

    XMLWordPrintable

    Details

      Description

      Although typical input validation relies on JS validation to validate input on the form, there are some cases when customers are invoking workflows via REST. In this case, the calling application should validate input data, however it may also be required that the workflow scripts do simple validation and throw an exception which would be translated to a HTTP response.

      Currently it seems that exceptions thrown in workflow scripts generate a HTTP 500 in every case. For example trying to throw a the following ResourceException from a groovy workflow script (as per https://backstage.forgerock.com/docs/idm/6.5/integrators-guide/#custom-script-errors): 

       

      import org.forgerock.json.resource.ResourceException            
      import org.forgerock.json.JsonValue            
      
      throw new ResourceException(400, "My custom error message").setDetail(new JsonValue(["var""parameter1","complexDetailObject" : ["detail1","detail2"]]))
      

      Results in a HTTP 500, with the following response:

      {     "code":500,    "reason":"Internal Server Error",    "message":"problem evaluating script: javax.script.ScriptException: org.forgerock.json.resource.ResourceException: My custom error message" }
      

      The ability to throw ResourceException and have them returned to the calling application would allow effective error handling for REST based services.

        Attachments

          Activity

            People

            Assignee:
            travis.haagen Travis Haagen
            Reporter:
            bradley.tarisznyas Brad Tarisznyas
            QA Assignee:
            Julian Keller Julian Keller
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: