ServiceStack.HttpResponseExtensionsInternal.HandleResponseWriteException C# (CSharp) 메소드

HandleResponseWriteException() 정적인 개인적인 메소드

static private HandleResponseWriteException ( this originalEx, IRequest request, IResponse response, string defaultContentType ) : Task
originalEx this
request IRequest
response IResponse
defaultContentType string
리턴 Task
        internal static Task<bool> HandleResponseWriteException(this Exception originalEx, IRequest request, IResponse response, string defaultContentType)
        {
            HostContext.RaiseAndHandleUncaughtException(request, response, request.OperationName, originalEx);

            if (!HostContext.Config.WriteErrorsToResponse)
                return originalEx.AsTaskException<bool>();

            var errorMessage = $"Error occured while Processing Request: [{originalEx.GetType().GetOperationName()}] {originalEx.Message}";

            try
            {
                if (!response.IsClosed)
                {
                    response.WriteErrorToResponse(
                        request,
                        defaultContentType ?? request.ResponseContentType,
                        request.OperationName,
                        errorMessage,
                        originalEx,
                        (int)HttpStatusCode.InternalServerError);
                }
            }
            catch (Exception writeErrorEx)
            {
                //Exception in writing to response should not hide the original exception
                Log.Info("Failed to write error to response: {0}", writeErrorEx);
                return originalEx.AsTaskException<bool>();
            }
            return TypeConstants.TrueTask;
        }