Skip to content

How to get errors and results with async update?  #999

@NealWalters

Description

@NealWalters

Question: The code below is called from another async function that gets the connection and does a query, then calls the UpdatePassword in a loop. It display the SqlUpdate variable, which I can run in another tool and it works fine.

So none of the three is happening:

  1. No data updated in database
  2. No err thrown (neither errQuery or the catch err2
  3. None of the console.logs after the 'await" are displayed.
async function UpdatePassword(connection, rowID) {
        ... code omitted ...
	console.log("SQL Update=" + sqlUpdate); 
	try 
	{
		var [rows, fields, errQuery] = await connection.query(sqlUpdate);
		if (errQuery) throw errQuery;
		console.log("Back from update");
		console.log("AffectedRows=" + rows.affectedRows);
        } catch (err2) 
         {
   	   console.log("*** Catch Error:") 
           console.log(err2.stack);
         }	
	console.log ("end function"); 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions