Skip to content

Commit bea898d

Browse files
committed
Adding try-catch around the getItemType
1 parent 25cc14b commit bea898d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardUtil.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ public static BrowserStackCredentials getBrowserStackCreds() {
1919
}
2020

2121
public static String getItemTypeModified(Item job) {
22-
if (job instanceof Job) {
23-
return job.getClass().getSimpleName().toUpperCase();
24-
}
25-
else if (job.getClass().getName().contains("Folder")) {
26-
return "FOLDER";
27-
}
28-
else {
22+
try {
23+
if (job instanceof Job) {
24+
return job.getClass().getSimpleName().toUpperCase();
25+
}
26+
else if (job.getClass().getName().contains("Folder")) {
27+
return "FOLDER";
28+
}
29+
else {
30+
return null;
31+
}
32+
} catch (Exception e) {
33+
// Return null in case of any error during job type determination
2934
return null;
3035
}
3136
}

0 commit comments

Comments
 (0)