Пример #1
0
        internal static R.StatusError GetError(R.Status status)
        {
            if (status.Errors == null || status.Errors.Length == 0)
            {
                throw MakeInvalidResponseError($"request failed with code '{status.StatusCode}/{status.Code}' " +
                                               $"and message '{status.Message}' but error wasn't provided");
            }

            return(status.Errors[0]);
        }
Пример #2
0
        private static InternalErrorException MakeInvalidResponseError(R.Status status)
        {
            var message = $"message: '{status.Message}', status code: '{status.StatusCode}/{status.Code}'";

            if (status.Errors?.Length > 0)
            {
                var error = GetError(status);
                message += $", error code: '{error.Code}'error message: '{error.Message}'";
            }

            return(MakeInvalidResponseError(message));
        }