private BWebServiceResponse OnRequest_Internal(HttpListenerContext _Context, Action <string> _ErrorMessageAction) { try { if (BatchProcessingService.Instance.CheckProcessComplete()) { return(BWebResponse.StatusOK(BatchProcessingService.Instance.State)); } else { return(BWebResponse.NotAcceptable("Queue not ready")); } } catch (Exception ex) { _ErrorMessageAction?.Invoke($"{ex.Message}\n{ex.StackTrace}"); return(BWebResponse.InternalError("Failed to get state")); } }