Closed ashwinikalantri closed 3 years ago
Nice catch.
A few things here. First, the error message is simply the one that the GraphQL server returns. I agree that it's wrong here. See code here. I'll check with the SuSo dev team to see if they could check for this situation and provide a more informative error message on the GraphQL side.
Second, I would like to check implement a check that the workspace provided in the argument exists. See debt coment here. Unfortunately, I don't see a way to do so. In the GraphQL schema, there are objects that one can query. Workspaces, regrettably, are not one. Also, even if they were one, I'm not sure if a non-admin would have privileges high enought to query it. Again, this is something I'll ask the SuSo dev team.
Thanks for catching this issue! I've not used these functions much beyond the unit tests yet, and thus haven't gained enough practical experience to identify these types of issues (even though some, like this one, did cross my mind during development).
Wups. Nevermind. I can get workspaces with this REST endpoint: GET /api/v1/workspaces
I'll fix this issue in all funtions that have workspaces as an argument when I return from vacation next week. I'll also create a new package version of susoapi
so that all of the changes to this point will be associated with that release.
While you are at it, the start_export
function also needs workspaces arguments. I can only export questionnaires from primary workspace. Enjoy your vacation!
If the name of the workspace is mistyped in the
get_questionnaire
function, instead of getting an error -Workspace doesn't exists
, you get -