protected virtual void SendResponseWithAttachment(ClientRequestInfo requestInfo, bool success, object attachment, string status, params object[] args)
{
try
{
// Send actionable response
m_serviceHelper.SendActionableResponse(requestInfo, success, attachment, status, args);
// Log details of client request as well as response
if (m_serviceHelper.LogStatusUpdates && m_serviceHelper.StatusLog.IsOpen)
{
string responseType = requestInfo.Request.Command + (success ? ":Success" : ":Failure");
string arguments = requestInfo.Request.Arguments.ToString();
string message = responseType + (string.IsNullOrWhiteSpace(arguments) ? "" : "(" + arguments + ")");
if (status != null)
{
if (args.Length == 0)
message += " - " + status;
else
message += " - " + string.Format(status, args);
}
m_serviceHelper.StatusLog.WriteTimestampedLine(message);
}
}
catch (Exception ex)
{
string message = string.Format("Failed to send client response due to an exception: {0}", ex.Message);
HandleException(new InvalidOperationException(message, ex));
}
}