[SOLVED] Problem with setError

Everything related to the development of modules in jamovi
Post Reply
User avatar
kylehamilton
Posts: 29
Joined: Fri Mar 24, 2017 8:47 am
Location: Merced, California, USA
Contact:

[SOLVED] Problem with setError

Post 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.
User avatar
Ravi
Posts: 194
Joined: Sat Jan 28, 2017 11:18 am

Re: Problem with setError

Post 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
User avatar
Ravi
Posts: 194
Joined: Sat Jan 28, 2017 11:18 am

Re: Problem with setError

Post 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.
User avatar
kylehamilton
Posts: 29
Joined: Fri Mar 24, 2017 8:47 am
Location: Merced, California, USA
Contact:

Re: Problem with setError

Post 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.
Post Reply