Solution Lockups

Hello everyone.

So I’m still working hard to unlearn 18 years of FileMaker development. I have an occasional occurrence with our Servoy solution that I know is likely caused by developer error.

For instance, we’re logging all solution errors in a log file. Throughout the day, we’ll have the occasional error such as:

TypeError: Cannot call method “toFixed” of null (trans_post#338)
TypeError: Cannot read property “cust_vend_id” from (pos_calculate_tax#80)

When I check these lines of code… they work fine, so obviously an event has occurred prior that causes these to fail. Most of the time, we figure it out, but sometimes, we have not yet determined what series of events caused the issue.

So when an error like this occurs, it seems to lock the table where it occurred on and although the solution appears to be working, certain functions no longer work. (specifically issues with editing records and/or finding records in that particular table)

We have been working on capturing all saveRecord() and checking for errors and reverting if we find one… thinking that would help but I wanted to see if there’s anything we can do to “Refresh” the solution without relaunching it in the event an error occurs because a relaunch always gets things going again?

I suspect that it’s a case of better error capture, I thought we’d ask.

Chico
Still a Servoy n00b

I suspect that

Also, this is the saveData() code we’re starting to implement… any suggestions?

var thySave = databaseManager.saveData()	
if (!thySave)
{
	var errSave = databaseManager.getLastDatabaseMessage()
	var errRecs = databaseManager.getFailedRecords()
	databaseManager.rollbackEditedRecords()
	application.setStatusText(errSave);
	
	// generate a log record in the error log
	try{
	log = new Object();
	log.message = "Userid " + globals.g_user_id + " had error " + errSave
	log.type = "Save Error";
	log.related_key = "";
	log.metadata = globals.g_cji_id;
	globals.newLog(log);	
	}finally{}						
}

TypeError: Cannot call method “toFixed” of null (trans_post#338)
TypeError: Cannot read property “cust_vend_id” from (pos_calculate_tax#80)

those 2 mean that you call toFixed on an object that is not there. It is null.
I think the same holds for the second error, also that one you ask for something of an object that isnt there.

Thanks Johan… our problem has been trying to find out why it wasn’t there, as most of the time, it isn’t null.