jsgoupil/quickbooks-sync

Error always logged on sync complete

Closed this issue · 7 comments

We get a an error logged each sync with the message

[QBError] Out - {KEY} Sync Completed

trying to find out if there actually an error occuring that we need to fix, or if this should be an informational message instead of an error.

@bzbetty Sorry but this seems to be your code logic? Is this coming from your LogMessage ?

I'm looking at line 406 of the Sync Manager

result = "Sync Completed";

I'm not sure what the problem is? LogMessage does not mean an error happened. LogMessage is called for anything going in or out the API.

The LogMessage is called with LogMessageType.Error, just means every completion is coming up in my logs as an error and not an info/debug message.

LogMessage(authenticatedTicket, LogMessageType.Error, LogDirection.Out, ticket, result);

Ah you are right. I misread that... sorry! It should definitely not be logged as an error. Thanks for pointing this out!

I think this would fix it:

try
{
    LogMessage(authenticatedTicket, LogMessageType.Close, LogDirection.In, ticket);

    var logMessageType = LogMessageType.Error;
    var result = "Invalid Ticket";

    if (authenticatedTicket != null)
    {
        result = "Sync Completed";
        logMessageType = LogMessageType.Close;
    }

    LogMessage(authenticatedTicket, logMessageType, LogDirection.Out, ticket, result);

    return result;
}

yeah that looks much better. thanks.