Is there a way to catch a query error?

In some predictable cases, a query will fail and user friendly messages could be given to the user to correct their mistake. Is there a way to catch this error in JavaScript like the ‘add-on error’ action in the action framework? When doing a try catch in JavaScript snippets, the error doesn’t get caught, and the jQuery promise is resolved.

I also tried subscribing to ‘models.load’ events but the event only fired on success of updateData()  and it seems to consider an updateData() call a success even when the query error message pops up

loaded
PUBLISHED:
at the end of a successful call to model.updateData()
https://docs.skuid.com/latest/en/skuid/api/skuid_events.html?#skuid.events.models.loaded


Thanks for your question!  Have you tried a callback function within the updateData call?

model&#46;updateData(function(result) {<br />&nbsp; &nbsp; &nbsp;if (result&#46;totalsuccess) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#47;&#47; Do something on success<br />&nbsp; &nbsp; &nbsp;else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#47;&#47; Do something on failure&nbsp;<br />&nbsp; &nbsp; &nbsp;}<br />}));

Hope this helps you out!

Christine

Thanks, I hadn’t tried it. I just tried it and although I’m setting the failure to do nothing, I still get the error in the screenshot below. Here’s the relevant code .

        dfrd = attachmentsMod.updateData(function(result) {            
            if (!result.totalsuccess) {
            // Do nothing on fail
            }
        });

I’m returning this deferred Jquery object later on.

Here’s a screenshot of the error.

I ended up passing this to apex, handling it there, and working off of the returned result.