Skip to content

Commit 8afd978

Browse files
Gracefully skip faulty resource types
1 parent 1ca371b commit 8afd978

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/_shared/modules/ResourceManager/module.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,10 +1928,14 @@ FrameTrail.defineModule('ResourceManager', function(FrameTrail){
19281928

19291929
for (var id in array) {
19301930

1931+
var resourceTypeName = 'Resource' + array[id].type.charAt(0).toUpperCase() + array[id].type.slice(1);
1932+
if (!FrameTrail.type(resourceTypeName)) {
1933+
console.warn('Skipping resource with unknown type: ' + array[id].type);
1934+
continue;
1935+
}
1936+
19311937
var resourceThumb = FrameTrail.newObject(
1932-
( 'Resource'
1933-
+ array[id].type.charAt(0).toUpperCase()
1934-
+ array[id].type.slice(1)),
1938+
resourceTypeName,
19351939
array[id]
19361940
).renderThumb(id);
19371941

@@ -2113,10 +2117,14 @@ FrameTrail.defineModule('ResourceManager', function(FrameTrail){
21132117

21142118
for (var i in resourceDatabase) {
21152119

2120+
var resourceTypeName = 'Resource' + resourceDatabase[i].type.charAt(0).toUpperCase() + resourceDatabase[i].type.slice(1);
2121+
if (!FrameTrail.type(resourceTypeName)) {
2122+
console.warn('Skipping resource with unknown type: ' + resourceDatabase[i].type);
2123+
continue;
2124+
}
2125+
21162126
resourceThumb = FrameTrail.newObject(
2117-
( 'Resource'
2118-
+ resourceDatabase[i].type.charAt(0).toUpperCase()
2119-
+ resourceDatabase[i].type.slice(1)),
2127+
resourceTypeName,
21202128
resourceDatabase[i]
21212129
).renderThumb();
21222130

0 commit comments

Comments
 (0)