handle parse errors
This commit is contained in:
@@ -405,13 +405,13 @@ parse_expression_attribute_names :: proc(request_body: []byte) -> Maybe(map[stri
|
|||||||
parse_expression_attribute_values :: proc(request_body: []byte) -> (map[string]Attribute_Value, bool) {
|
parse_expression_attribute_values :: proc(request_body: []byte) -> (map[string]Attribute_Value, bool) {
|
||||||
data, parse_err := json.parse(request_body, allocator = context.temp_allocator)
|
data, parse_err := json.parse(request_body, allocator = context.temp_allocator)
|
||||||
if parse_err != nil {
|
if parse_err != nil {
|
||||||
return make(map[string]Attribute_Value), true
|
return make(map[string]Attribute_Value), false
|
||||||
}
|
}
|
||||||
defer json.destroy_value(data)
|
defer json.destroy_value(data)
|
||||||
|
|
||||||
root, ok := data.(json.Object)
|
root, ok := data.(json.Object)
|
||||||
if !ok {
|
if !ok {
|
||||||
return make(map[string]Attribute_Value), true
|
return make(map[string]Attribute_Value), false
|
||||||
}
|
}
|
||||||
|
|
||||||
values_val, found := root["ExpressionAttributeValues"]
|
values_val, found := root["ExpressionAttributeValues"]
|
||||||
@@ -421,7 +421,7 @@ parse_expression_attribute_values :: proc(request_body: []byte) -> (map[string]A
|
|||||||
|
|
||||||
values_obj, values_ok := values_val.(json.Object)
|
values_obj, values_ok := values_val.(json.Object)
|
||||||
if !values_ok {
|
if !values_ok {
|
||||||
return make(map[string]Attribute_Value), true
|
return make(map[string]Attribute_Value), false
|
||||||
}
|
}
|
||||||
|
|
||||||
result := make(map[string]Attribute_Value)
|
result := make(map[string]Attribute_Value)
|
||||||
|
|||||||
12
main.odin
12
main.odin
@@ -1165,7 +1165,11 @@ handle_query :: proc(engine: ^dynamodb.Storage_Engine, request: ^HTTP_Request, r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attr_values, _ := dynamodb.parse_expression_attribute_values(request.body)
|
attr_values, vals_ok := dynamodb.parse_expression_attribute_values(request.body)
|
||||||
|
if !vals_ok {
|
||||||
|
make_error_response(response, .ValidationException, "Invalid ExpressionAttributeValues")
|
||||||
|
return
|
||||||
|
}
|
||||||
defer {
|
defer {
|
||||||
for k, v in attr_values {
|
for k, v in attr_values {
|
||||||
delete(k)
|
delete(k)
|
||||||
@@ -1330,7 +1334,11 @@ handle_scan :: proc(engine: ^dynamodb.Storage_Engine, request: ^HTTP_Request, re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attr_values, _ := dynamodb.parse_expression_attribute_values(request.body)
|
attr_values, vals_ok := dynamodb.parse_expression_attribute_values(request.body)
|
||||||
|
if !vals_ok {
|
||||||
|
make_error_response(response, .ValidationException, "Invalid ExpressionAttributeValues")
|
||||||
|
return
|
||||||
|
}
|
||||||
defer {
|
defer {
|
||||||
for k, v in attr_values {
|
for k, v in attr_values {
|
||||||
delete(k)
|
delete(k)
|
||||||
|
|||||||
Reference in New Issue
Block a user