예제 #1
0
        /// <summary>
        /// Write exception to output message
        /// </summary>
        public async Task WriteExceptionAsync(HttpResponse httpResponse, Exception ex)
        {
            var webx        = WebSyncException.GetWebSyncException(ex);
            var webXMessage = JsonConvert.SerializeObject(webx);

            httpResponse.StatusCode    = StatusCodes.Status400BadRequest;
            httpResponse.ContentLength = webXMessage.Length;
            await httpResponse.WriteAsync(webXMessage);
        }
예제 #2
0
        /// <summary>
        /// Write exception to output message
        /// </summary>
        public Task <HttpResponseMessage> WriteExceptionAsync(Exception ex)
        {
            var webx        = WebSyncException.GetWebSyncException(ex);
            var webXMessage = JsonConvert.SerializeObject(webx);

            var response = new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                Content = new StringContent(webXMessage)
            };

            return(Task.FromResult(response));
        }