Skip to content

Commit 79b9801

Browse files
committed
lint
1 parent 8b5161f commit 79b9801

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/dashboard/Data/Browser/DataBrowser.react.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -842,18 +842,17 @@ export default class DataBrowser extends React.Component {
842842
}
843843

844844
urls.forEach(url => {
845-
try {
846-
if (mediaType === 'image') {
847-
const img = new Image();
848-
img.src = url;
849-
} else if (mediaType === 'video' || mediaType === 'audio') {
850-
// For video and audio, we can use fetch to cache the content
851-
fetch(url, { mode: 'no-cors' }).catch(() => {
852-
// Silently fail - the media will load normally if prefetch fails
853-
});
854-
}
855-
} catch (error) {
856-
// Silently fail - the media will load normally if prefetch fails
845+
if (mediaType === 'image') {
846+
const img = new Image();
847+
img.onerror = () => {
848+
console.error(`Failed to prefetch image: ${url}`);
849+
};
850+
img.src = url;
851+
} else if (mediaType === 'video' || mediaType === 'audio') {
852+
// For video and audio, we can use fetch to cache the content
853+
fetch(url, { mode: 'no-cors' }).catch(error => {
854+
console.error(`Failed to prefetch ${mediaType}: ${url}`, error);
855+
});
857856
}
858857
});
859858
}

0 commit comments

Comments
 (0)