More work on bug #7393.  This streamlines things, and makes it so that it doesn't try to log a database error to the database.