Ah, so my turn. I see what you are saying and I do that.
Here's the way it goes for my code.
1) If a web exception is thrown, I do catch and parse the response. The log entry will be "SD API WebException Thrown. Message: {0} , Status: {1}". If the response is in the SD error message format like you posted above, it will add another log entry of "SD responded with error code: {0} , message: {1} , serverID: {2} , datetime: {3}". Here is an example of a WebException.
Code: Select all
[1/3/2020 4:22:02 AM] [ INFO] SD API WebException Thrown. Message: The remote server returned an error: (400) Bad Request. , Status: ProtocolError
[1/3/2020 4:22:02 AM] [ INFO] SD responded with error code: 4102 , message: No lineups have been added to this account. , serverID: 20141201.web.1 , datetime: 2020-01-03T11:22:02Z
2) If a response is received, and there is no exception, then it will evaluate the "code" of the message to integer 0. If not 0, then it will report the status like I got for yesterday mornings update. This is what you are saying should happen and it does happen.
Code: Select all
[4/19/2020 4:22:01 AM] [ERROR] Failed token request. code: 3000 , message: Server offline for maintenance. , datetime: 2020-04-19T11:22:01Z
[4/19/2020 4:22:01 AM] [ERROR] Failed to retrieve token from Schedules Direct. message: Failed token request. code: 3000 , message: Server offline for maintenance. , datetime: 2020-04-19T11:22:01Z
3) If the status code is 0, but the response serverID is null, then it will throw a null exception. (this is only because for a successful token request, I will log the serverId in the trace.log)
#3 may be where your exception got thrown. It didn't get a web exception, and the status response was 0, but it was still invalid/incomplete. This is not something that could reasonably be expected; to have a successful token request without a server.
Now I don't evaluate the status code for all message returns, just the /token, /status, /version, /lineups, and adding/removing a lineup. So we can certainly say there is a gap there in the logging for the other messages.