Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
Checking the custom query for parse errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangrimm committed Aug 17, 2011
1 parent 6c4a484 commit 7ddc1ab
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions data/store.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,17 @@ let $properties := local:propertiesFromRequest($params, "property")
let $permissions := local:permissionsFromRequest($params, "permission")
let $quality := local:qualityFromRequest($params)

(: XXX - check for parse errors :)
let $query := (parser:parse(map:get($params, "q")), customquery:getCTS(customquery:getParseTree(map:get($params, "customquery"))))[1]
let $test := (
)
let $customQuery :=
try {
customquery:getParseTree(map:get($params, "customquery"))
}
catch ($e) {
xdmp:set($test, common:error(400, concat("The custom query JSON isn't valid: ", $e/*:message), $contentType))
}

let $query := (parser:parse(map:get($params, "q")), customquery:getCTS($customQuery))[1]

where string-length($uri) or ($requestMethod = "DELETE" and exists($query))
return
Expand Down

0 comments on commit 7ddc1ab

Please sign in to comment.