-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: OpenIDM 4.0.0, OpenIDM 4.5.0
-
Fix Version/s: OpenIDM 4.5.0
-
Component/s: Module - Scripting
-
Labels:
As originally noted here: https://bugster.forgerock.org/jira/browse/SCRIPT-10?focusedCommentId=64143&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-64143
Calls to the script service which throw an exception are not handled properly:
curl --data '{ "type": "groovy", "source": " import org.forgerock.json.resource.ResourceException; throw new ResourceException(404, \"It aint there\").setDetail(new org.forgerock.json.JsonValue([a:1]))" }' -u openidm-admin:openidm-admin -k -X POST -H "Content-type: application/json" https://localhost:8443/openidm/script?_action=eval
Produces this:
{"code":500,"reason":"Internal Server Error","message":"It aint there"}
Note the lack of the detail and the wrong code. Similarly, JS doesn't work properly (see link for details)
Those same scripts work fine when executed as part of a custom endpoint, defined (for example) like so:
{ "type" : "groovy", "source" : " import org.forgerock.json.resource.ResourceException; import org.forgerock.json.JsonValue; throw new ResourceException(404, \"It ain't there\").setDetail(new JsonValue([\"var\": \"blah\", \"complexDetailObject\" : [\"detail1\",\"detail2\"]]))" }
- relates to
-
SCRIPT-10 No way to throw a ResourceException from groovy
-
- Resolved
-