Page 1 of 1

[SOLVED] Problem with setError

Posted: Sun Jul 23, 2017 8:14 am
by kylehamilton
Hi I'm trying to get my Jamovi module to display an error message when the code in the background gives a warning or stop command. Is there some example code somewhere that I could look at? Right now before a user assigns variables in Jamovi metafor throws up an error asking for either vi (sampling variances) or sei (standard errors). What I would like for it to do is when this error happens have Jamovi display a custom error message instead. I've gone over the documentation but it's still not working.

Re: Problem with setError

Posted: Sun Jul 23, 2017 8:23 am
by Ravi
Hi Kyle,

You can use jmvcore::reject() for this. You can find an example of its use over here: https://github.com/jamovi/jmv/blob/99ed ... #L204-L219.

Cheers

Re: Problem with setError

Posted: Sun Jul 23, 2017 8:30 am
by Ravi
However, instead of throwing an error it might make more sense to only run the analysis when the variables are assigned (that's what we do with our analyses). You can find an example of this in the same file: https://github.com/jamovi/jmv/blob/99ed ... .R#L14-L18.

Re: Problem with setError

Posted: Sun Jul 23, 2017 11:00 pm
by kylehamilton
Thank you so much! This fixed everything and makes the module look a lot cleaner. I never even thought to check the help file in jmvcore I was only looking at the dev website. I'll make sure to check jmvcore next time I run into a problem.