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 = () => {
5656} ;
5757
5858exports . render = ( file ) => {
59- // Reading the file
6059 fs . readFile ( file , 'utf8' , ( err , content ) => {
6160 if ( err ) {
6261 console . error ( err ) ;
6362 exit ( 1 ) ;
6463 }
6564 // 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+ } ) ;
6973 } ) ;
7074} ;
7175
@@ -166,7 +170,7 @@ function printBestPage(command, options={}) {
166170 } ) ;
167171}
168172
169- function renderContent ( content , options ) {
173+ function renderContent ( content , options = { } ) {
170174 if ( options . markdown ) {
171175 return console . log ( content ) ;
172176 }
You can’t perform that action at this time.
0 commit comments