コード例 #1
0
        private Either <RfcErrorInfo, TResult> ResultOrError <TResult>(TResult result, RfcRc rc, RfcErrorInfo errorInfo)
        {
            if (rc != RfcRc.RFC_OK)
            {
                Logger.IfSome(l => l.LogDebug("received error from rfc call", errorInfo));
                return(errorInfo);
            }

            Logger.IfSome(l => l.LogTrace("received result value from rfc call", result));
            return(result);
        }
コード例 #2
0
        private Either <RfcErrorInfo, TResult> ResultOrError <TResult>(TResult result, RfcErrorInfo errorInfo, bool logAsError = false)
        {
            if (result == null || errorInfo.Code != RfcRc.RFC_OK)
            {
                Logger.IfSome(l =>
                {
                    if (errorInfo.Code == RfcRc.RFC_OK)
                    {
                        if (logAsError)
                        {
                            l.LogError("received null result from api call.");
                        }
                        else
                        {
                            l.LogDebug("received null result from api call.");
                        }
                    }

                    if (logAsError)
                    {
                        l.LogError("received error from rfc call", errorInfo);
                    }
                    else
                    {
                        l.LogDebug("received error from rfc call", errorInfo);
                    }
                });
                return(errorInfo);
            }

            Logger.IfSome(l => l.LogTrace("received result value from rfc call", result));

            return(result);
        }