Catch typecast errors
This commit is contained in:
parent
a9e7e23724
commit
62bdd9d26a
43
execution.py
43
execution.py
|
@ -424,7 +424,8 @@ def validate_inputs(prompt, item, validated):
|
||||||
"extra_info": {
|
"extra_info": {
|
||||||
"input_name": x,
|
"input_name": x,
|
||||||
"input_config": info,
|
"input_config": info,
|
||||||
"received_type": received_type
|
"received_type": received_type,
|
||||||
|
"linked_node": val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
errors.append(error)
|
errors.append(error)
|
||||||
|
@ -440,28 +441,44 @@ def validate_inputs(prompt, item, validated):
|
||||||
valid = False
|
valid = False
|
||||||
exception_type = full_type_name(typ)
|
exception_type = full_type_name(typ)
|
||||||
reasons = [{
|
reasons = [{
|
||||||
"type": "exception_during_validation",
|
"type": "exception_during_inner_validation",
|
||||||
"message": "Exception when validating node",
|
"message": "Exception when validating inner node",
|
||||||
"details": str(ex),
|
"details": str(ex),
|
||||||
"extra_info": {
|
"extra_info": {
|
||||||
"input_name": x,
|
"input_name": x,
|
||||||
"input_config": info,
|
"input_config": info,
|
||||||
"exception_type": exception_type,
|
"exception_type": exception_type,
|
||||||
"traceback": traceback.format_tb(tb)
|
"traceback": traceback.format_tb(tb),
|
||||||
|
"linked_node": val
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
validated[o_id] = (False, reasons, o_id)
|
validated[o_id] = (False, reasons, o_id)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if type_input == "INT":
|
try:
|
||||||
val = int(val)
|
if type_input == "INT":
|
||||||
inputs[x] = val
|
val = int(val)
|
||||||
if type_input == "FLOAT":
|
inputs[x] = val
|
||||||
val = float(val)
|
if type_input == "FLOAT":
|
||||||
inputs[x] = val
|
val = float(val)
|
||||||
if type_input == "STRING":
|
inputs[x] = val
|
||||||
val = str(val)
|
if type_input == "STRING":
|
||||||
inputs[x] = val
|
val = str(val)
|
||||||
|
inputs[x] = val
|
||||||
|
except Exception as ex:
|
||||||
|
error = {
|
||||||
|
"type": "invalid_input_type",
|
||||||
|
"message": f"Failed to convert an input value to a {type_input} value",
|
||||||
|
"details": f"{x}, {val}, {ex}",
|
||||||
|
"extra_info": {
|
||||||
|
"input_name": x,
|
||||||
|
"input_config": info,
|
||||||
|
"received_value": val,
|
||||||
|
"exception_message": str(ex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errors.append(error)
|
||||||
|
continue
|
||||||
|
|
||||||
if len(info) > 1:
|
if len(info) > 1:
|
||||||
if "min" in info[1] and val < info[1]["min"]:
|
if "min" in info[1] and val < info[1]["min"]:
|
||||||
|
|
Loading…
Reference in New Issue