Skip to content

Commit

Permalink
prevent promise from uncaught rejection error inside save chapter method
Browse files Browse the repository at this point in the history
  • Loading branch information
ronny1982 committed Aug 4, 2019
1 parent d3275e7 commit 12d8e83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/web/lib/hakuneko/engine/storage.html
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,9 @@
data: page
}
});
let output = this._chapterOutputPath( chapter );

let promise = Promise.reject( new Error( 'Unsupported output format: ' + Engine.Settings.chapterFormat.value ) );
let promise = undefined;
let output = this._chapterOutputPath( chapter );
if( Engine.Settings.chapterFormat.value === ChapterFormat.img ) {
this._createDirectoryChain( output );
promise = this._saveChapterPagesFolder( output, pageData )
Expand All @@ -448,7 +448,7 @@
promise = this._saveChapterPagesEPUB( output, pageData )
.then( () => this._runPostChapterDownloadCommand( chapter, output ) );
}
return promise;
return promise || Promise.reject( new Error( 'Unsupported output format: ' + Engine.Settings.chapterFormat.value ) );
} catch( error ) {
return Promise.reject( error );
}
Expand Down

0 comments on commit 12d8e83

Please sign in to comment.