Skip to content

Commit

Permalink
add: logging and error handling (#4493)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrgoblings authored Dec 4, 2024
1 parent e1f9f3f commit a10f9ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for (let i = 0; i < navigationExtensions.length; i++) {
const navigation = getNavigation();
navigationList.push(navigation);
} catch (err) {
console.error(err)
console.error(`Failed to load a navigation group in NavigationService: ${err}\npath: ${path}`);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for (let i = 0; i < groupExtensions.length; i++) {
const group = getGroup();
groupList.push(group);
} catch (err) {
console.error(err)
console.error(`Failed to load a widget in WidgetService: ${err}\npath: ${path}`);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ navigation.controller("LaunchpadViewController", ["$scope", "messageHub", "$http
function loadNavigationGroups() {
return $http.get("/services/js/portal/api/NavigationGroupsExtension/NavigationGroupsService.js")
.then(function (response) {
for (itemData of response.data) {
if (!itemData || !itemData.icon || !itemData.order || !itemData.label) {
console.error(`Invalid navigation group data: ${JSON.stringify(itemData)}. Missing one of the properties: icon, order, label`);
return;
}
}

$scope.groups = response.data;

$scope.groups.sort((a, b) => a.order - b.order)

response.data.forEach(elem => {
$scope.groupItems[elem.label.toLowerCase()] = [];
});
Expand Down Expand Up @@ -41,7 +50,7 @@ navigation.controller("LaunchpadViewController", ["$scope", "messageHub", "$http

function addNavigationItem(itemData) {
if (!itemData || !itemData.label || !itemData.group || !itemData.order || !itemData.link) {
console.error('Invalid item data:', itemData);
console.error(`Invalid item data: ${JSON.stringify(itemData)} Missing one of the properties: label, group, order, link`);
return;
}

Expand All @@ -54,7 +63,8 @@ navigation.controller("LaunchpadViewController", ["$scope", "messageHub", "$http
$scope.groupItems[groupKey].push({
id: itemData.id,
label: itemData.label,
link: itemData.link
link: itemData.link,
order: itemData.order
});
}

Expand Down

0 comments on commit a10f9ae

Please sign in to comment.