Skip to content

Commit

Permalink
properly throws
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-pelagatti committed Nov 28, 2023
1 parent 43cab7a commit e03f907
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/decode/loaders/GainMapLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,17 @@ export class GainMapLoader extends LoaderBase<[string, string, string]> {

const loadCheck = async () => {
if (sdr && gainMap && metadata) {
await this.render(quadRenderer, metadata, sdr, gainMap)
// solves #16
try {
await this.render(quadRenderer, metadata, sdr, gainMap)
} catch (error) {
this.manager.itemError(sdrUrl)
this.manager.itemError(gainMapUrl)
this.manager.itemError(metadataUrl)
if (typeof onError === 'function') onError(error)
quadRenderer.disposeOnDemandRenderer()
return
}

if (typeof onLoad === 'function') onLoad(quadRenderer)
this.manager.itemEnd(sdrUrl)
Expand Down
11 changes: 10 additions & 1 deletion src/decode/loaders/HDRJPGLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,16 @@ export class HDRJPGLoader extends LoaderBase<string> {
throw e
}
}
await this.render(quadRenderer, metadata, sdrJPEG, gainMapJPEG)

// solves #16
try {
await this.render(quadRenderer, metadata, sdrJPEG, gainMapJPEG)
} catch (error) {
this.manager.itemError(url)
if (typeof onError === 'function') onError(error)
quadRenderer.disposeOnDemandRenderer()
return
}

if (typeof onLoad === 'function') onLoad(quadRenderer)
this.manager.itemEnd(url)
Expand Down

0 comments on commit e03f907

Please sign in to comment.