You can just assign nodes[i].dataType = paramTypes[i]; when you successfully return from this function. Then fall through to the existing continue statement
You don't need "ex" at all.
You can just "throw Error.error(ErrorCode.X_42565); // incompatible data type" from inside the catch block.