wip: allow initializing dataset by id#566
Conversation
| if (!isEmpty(datasetId)) { | ||
| throw new Error( | ||
| "Cannot specify datasetId and project or dataset name", | ||
| ); | ||
| } |
There was a problem hiding this comment.
The conditional check if (!isEmpty(datasetId)) is located inside an else block that only executes when datasetId is falsy, making this validation ineffective. To properly prevent users from specifying both a datasetId and project/dataset name parameters simultaneously, this validation should be moved outside the if/else structure, before line 2540.
A more effective approach would be:
if (datasetId && (!isEmpty(project) || !isEmpty(dataset))) {
throw new Error(
"Cannot specify datasetId and project or dataset name"
);
}
if (datasetId) {
// fetch existing dataset logic
} else {
// create new dataset logic
}| if (!isEmpty(datasetId)) { | |
| throw new Error( | |
| "Cannot specify datasetId and project or dataset name", | |
| ); | |
| } | |
| if (datasetId && (!isEmpty(project) || !isEmpty(dataset))) { | |
| throw new Error( | |
| "Cannot specify datasetId and project or dataset name", | |
| ); | |
| } |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If this PR is still relevant, please leave a comment, push an update, or remove the stale label. Thank you for your contributions! |
|
This pull request was closed because it has been inactive for 21 days (14 days of inactivity before being marked stale, plus 7 additional days). If this PR is still relevant, please feel free to reopen it. Thank you! |
No description provided.