Skip to content

Commit

Permalink
fix(player): missing libraries omitted when listing libraries (closes
Browse files Browse the repository at this point in the history
…#501) (#504)

* fix(player): missing ones omitted when listing libraries (closes #501)
  • Loading branch information
sr258 authored May 12, 2020
1 parent c5c8ae2 commit 9caf6ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/DependencyGetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ export default class DependencyGetter {
if (libraries.has(LibraryName.toUberName(library))) {
return null;
}
let metadata;
try {
metadata = await this.libraryStorage.getLibrary(library);
} catch {
// We silently ignore missing libraries, as this can happen with
// 'fake libraries' used by the H5P client (= libraries which are
// referenced in the parameters, but don't exist)
return libraries;
}
libraries.add(LibraryName.toUberName(library));

const metadata = await this.libraryStorage.getLibrary(library);
if (preloaded && metadata.preloadedDependencies) {
await this.addDependenciesToSet(
metadata.preloadedDependencies,
Expand Down
10 changes: 8 additions & 2 deletions src/H5PPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,14 @@ export default class H5PPlayer {
if (key in loaded) {
return;
}

const lib = await this.getLibrary(name, majVer, minVer);
let lib;
try {
lib = await this.getLibrary(name, majVer, minVer);
} catch {
log.info(
`Could not find library ${name}-${majVer}.${minVer} in storage. Silently ignoring...`
);
}
if (lib) {
loaded[key] = lib;
await this.getLibraries(
Expand Down

0 comments on commit 9caf6ac

Please sign in to comment.