Debugging Value Triggers

How do I debug value triggers? The examples look like this is JavaScript code? At least the “alert()” function seems to work.

When I make an error (syntax error, or I forget to put “mc.” in front of the runtime API call) in the script, MiraCheck just quits abruptly. How can I see the actual error message that the parser has thrown?

Is there a better to test these scripts than going back to the app on a mobile device, doing a sync, starting a new session of this checklist, going through the mandatory items that come before and finally testing? How do you guys do it? E.g. a way to test in-desktop-browser? That would already be much better.

Because MiraCheck is a native app it is not easy to debug javascript. Currently there is not a great way to debug other than alert. A great thing to to is to wrap a try {} catch (err) {} around your code and then alert the error. This will work in most cases.

try {
   mc.badFunction("blah");
} catch (err) {
   mcAlert.alert(err.message);  
}

Version 5 will have a console you can access from within the app that will make it a bit easier to write info to without having to popup a bunch of alerts.

1 Like