Facebook.ExceptionFactory.GetGraphException C# (CSharp) Method

GetGraphException() private method

private GetGraphException ( WebException exception ) : FacebookApiException
exception WebException
return FacebookApiException
        internal static FacebookApiException GetGraphException(WebException exception)
        {
            Contract.Requires(exception != null);

            return GetGraphException(new WebExceptionWrapper(exception));
        }
    }

Same methods

ExceptionFactory::GetGraphException ( WebExceptionWrapper exception ) : FacebookApiException
ExceptionFactory::GetGraphException ( object result ) : FacebookApiException
ExceptionFactory::GetGraphException ( string json ) : FacebookApiException

Usage Example

        /// <summary>
        /// Processes the batch result.
        /// </summary>
        /// <param name="result">
        /// The json result.
        /// </param>
        /// <returns>
        /// Batch result.
        /// </returns>
        internal static object ProcessBatchResult(object result)
        {
            Contract.Requires(result != null);
            Contract.Ensures(Contract.Result <object>() != null);

            IList <object> list = new JsonArray();

            var resultList = (IList <object>)result;

            foreach (var row in resultList)
            {
                var body      = (string)((IDictionary <string, object>)row)["body"];
                var exception = ExceptionFactory.GetGraphException(body);

                object jsonObject = null;
                if (exception == null)
                {
                    // check for rest exception
                    jsonObject = JsonSerializer.Current.DeserializeObject(body);
                    exception  = ExceptionFactory.GetRestException(jsonObject);
                }

                list.Add(exception ?? jsonObject);
            }

            return(list);
        }
All Usage Examples Of Facebook.ExceptionFactory::GetGraphException