Skip to content

Commit e031c41

Browse files
committed
Use CLI to exit rather than throw
1 parent 86ffd64 commit e031c41

File tree

1 file changed

+17
-20
lines changed
  • lib/node_modules/@stdlib/_tools/pkgs/readmes/bin

1 file changed

+17
-20
lines changed

lib/node_modules/@stdlib/_tools/pkgs/readmes/bin/cli

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,6 @@ var CLI = require( '@stdlib/cli/ctor' );
2828
var find = require( './../lib' ); // eslint-disable-line stdlib/no-redeclare
2929

3030

31-
// FUNCTIONS //
32-
33-
/**
34-
* Callback invoked after finding package READMEs.
35-
*
36-
* @private
37-
* @param {(Error|null)} error - error object
38-
* @param {(EmptyArray|StringArray)} files - list of files
39-
* @throws {Error} unexpected error
40-
*/
41-
function onFiles( error, files ) {
42-
if ( error ) {
43-
throw error;
44-
}
45-
if ( files.length ) {
46-
console.log( files.join( '\n' ) ); // eslint-disable-line no-console
47-
}
48-
}
49-
50-
5131
// MAIN //
5232

5333
/**
@@ -96,6 +76,23 @@ function main() {
9676
}
9777
// Find package READMEs:
9878
find( opts, onFiles );
79+
80+
/**
81+
* Callback invoked after finding package READMEs.
82+
*
83+
* @private
84+
* @param {(Error|null)} error - error object
85+
* @param {(EmptyArray|StringArray)} files - list of files
86+
* @returns {void}
87+
*/
88+
function onFiles( error, files ) {
89+
if ( error ) {
90+
return cli.error( error );
91+
}
92+
if ( files.length ) {
93+
console.log( files.join( '\n' ) ); // eslint-disable-line no-console
94+
}
95+
}
9996
}
10097

10198
main();

0 commit comments

Comments
 (0)