How to catch error in SQLImport


I have the following code:

data = JSON.stringify(DBjson)
SQLImport(data, DB, importComplete, NSB.overwriteAlmays)

If everything ok with the “data” then I can import and restore the database. But if “data” content error nothing happen and data not restore. My question is how do we catch the error?. By the way I am using the latest version on Mac.

SQLImport has no ability to deal with bad data coming in. You’ll need to solve this when you’re creating the data.

If the data error is in the JSON formatting, then the stringify will fail. You can catch that error with Try / Catch in javascript. I don’t use the Basic in AppStudio to suggest anything.

Thank you for your reply. I use Basic in AppStudio. I will try the Try/Catch javascript.

I’ve used Try/Catch in Basic and believe it works ok there as well.