Skip to content

Commit b1af87f

Browse files
committed
Add null check
1 parent 9cb618e commit b1af87f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ try {
396396
throw new Error("Traffic is required");
397397
}
398398

399+
// Check if deployment YAML file exists
400+
if (!deploymentYamlFilePath) {
401+
throw new Error("Deployment YAML file path is required.");
402+
}
403+
399404
// Check if the resource group exists
400405
console.log(`🔹 Checking if resource group '${resourceGroup}' exists...`)
401406
;
@@ -431,7 +436,7 @@ try {
431436
}
432437

433438
// Check if registry name is provided
434-
if (registryName !== undefined) {
439+
if (registryName !== undefined && registryName !== "") {
435440

436441
// Check if the registry exists
437442
console.log(`🔹 Checking if registry '${registryName}' exists in resource group '${registryResourceGroup}'...`);
@@ -445,7 +450,7 @@ try {
445450
}
446451

447452
// Check if model exists in registry
448-
if(registryName !== undefined) {
453+
if(registryName !== undefined && registryName !== "") {
449454
console.log(`🔹 Checking if model '${modelName}' exists in registry '${registryName}'...`);
450455

451456
const modelInRegistryExists = await checkIfModelInRegistryExists(
@@ -469,10 +474,6 @@ try {
469474
}
470475
}
471476

472-
// Check if deployment YAML file exists
473-
if (!deploymentYamlFilePath) {
474-
throw new Error("Deployment YAML file path is required.");
475-
}
476477
console.log(`🔹 Checking if deployment YAML file '${deploymentYamlFilePath}' exists...`);
477478

478479
// Check if the deployment YAML file exists

0 commit comments

Comments
 (0)