public static DynamoDbException FromJson(JsonObject json) { var type = json["__type"].ToString(); var message = ""; if (json.ContainsKey("message")) { message = json["message"].ToString(); } else if (json.ContainsKey("Message")) { message = json["Message"].ToString(); } if (type != null) { type = type.Split('#')[1]; } if (type == "ConditionalCheckFailedException") { return(new Conflict(message)); } var error = new DynamoDbException(message) { Type = type }; return(error); }
protected override async Task <Exception> GetExceptionAsync(HttpResponseMessage response) { string responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var ex = DynamoDbException.Parse(responseText); ex.StatusCode = (int)response.StatusCode; return(ex); }
protected override async Task <Exception> GetExceptionAsync(HttpResponseMessage response) { using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); var ex = await DynamoDbException.DeserializeAsync(stream).ConfigureAwait(false); ex.StatusCode = (int)response.StatusCode; return(ex); }