File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,20 @@ exports.randomExample = () => {
56
56
} ;
57
57
58
58
exports . render = ( file ) => {
59
- // Reading the file
60
59
fs . readFile ( file , 'utf8' , ( err , content ) => {
61
60
if ( err ) {
62
61
console . error ( err ) ;
63
62
exit ( 1 ) ;
64
63
}
65
64
// Getting the shortindex first to populate the shortindex var
66
- index . getShortIndex ( ( ) => {
67
- renderContent ( content ) ;
68
- } ) ;
65
+ index . getShortIndex ( )
66
+ . then ( ( ) => {
67
+ renderContent ( content ) ;
68
+ } )
69
+ . catch ( ( err ) => {
70
+ console . error ( err ) ;
71
+ exit ( 1 ) ;
72
+ } ) ;
69
73
} ) ;
70
74
} ;
71
75
@@ -166,7 +170,7 @@ function printBestPage(command, options={}) {
166
170
} ) ;
167
171
}
168
172
169
- function renderContent ( content , options ) {
173
+ function renderContent ( content , options = { } ) {
170
174
if ( options . markdown ) {
171
175
return console . log ( content ) ;
172
176
}
You can’t perform that action at this time.
0 commit comments