File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -10,25 +10,25 @@ const winston = require('winston');
10
10
const PATH_TO_AXE = path . join ( path . dirname ( require . resolve ( 'axe-core' ) ) , 'axe.min.js' ) ;
11
11
if ( ! fs . existsSync ( PATH_TO_AXE ) ) {
12
12
winston . verbose ( PATH_TO_AXE ) ;
13
- process . exit ( 1 ) ;
13
+ throw new Error ( 'Can’t find aXe' ) ;
14
14
}
15
15
16
16
const PATH_TO_H5O = path . join ( path . dirname ( require . resolve ( 'h5o' ) ) , 'dist/outliner.min.js' ) ;
17
17
if ( ! fs . existsSync ( PATH_TO_H5O ) ) {
18
18
winston . verbose ( PATH_TO_H5O ) ;
19
- process . exit ( 1 ) ;
19
+ throw new Error ( 'Can’t find h5o' ) ;
20
20
}
21
21
22
22
const PATH_TO_ACE_AXE = path . join ( __dirname , '../scripts/ace-axe.js' ) ;
23
23
if ( ! fs . existsSync ( PATH_TO_ACE_AXE ) ) {
24
24
winston . verbose ( PATH_TO_ACE_AXE ) ;
25
- process . exit ( 1 ) ;
25
+ throw new Error ( 'Can’t find ace-axe script' ) ;
26
26
}
27
27
28
28
const PATH_TO_ACE_EXTRACTION = path . join ( __dirname , '../scripts/ace-extraction.js' ) ;
29
29
if ( ! fs . existsSync ( PATH_TO_ACE_EXTRACTION ) ) {
30
30
winston . verbose ( PATH_TO_ACE_EXTRACTION ) ;
31
- process . exit ( 1 ) ;
31
+ throw new Error ( 'Can’t find ace-extraction script' ) ;
32
32
}
33
33
// EMXIF
34
34
Original file line number Diff line number Diff line change 4
4
5
5
const ace = require ( '../core/ace.js' ) ;
6
6
const meow = require ( 'meow' ) ;
7
+ const winston = require ( 'winston' ) ;
7
8
8
9
const cli = meow ( `
9
10
Usage
@@ -40,6 +41,9 @@ ace(cli.input[0], {
40
41
tmpdir : cli . flags . tempdir ,
41
42
verbose : cli . flags . verbose ,
42
43
silent : cli . flags . silent ,
43
- jobId : ''
44
+ jobId : '' ,
44
45
} )
45
- . catch ( ( ) => process . exit ( 1 ) ) ;
46
+ . catch ( ( err ) => {
47
+ winston . error ( err . message ) ;
48
+ process . exit ( 1 ) ;
49
+ } ) ;
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ module.exports = function ace(epubPath, options) {
22
22
// Check that the EPUB exists
23
23
if ( ! fs . existsSync ( epubPath ) ) {
24
24
winston . error ( `Couldn’t find EPUB file '${ epubPath } '` ) ;
25
- reject ( jobId ) ;
25
+ return reject ( jobId ) ;
26
26
}
27
27
28
28
// Process options
You can’t perform that action at this time.
0 commit comments