Skip to content

Commit c4f908b

Browse files
committed
Build Tooling: Reinstate error handling to build script
1 parent 6663433 commit c4f908b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

bin/packages/build-worker.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,15 @@ const BUILD_TASK_BY_EXTENSION = {
145145
module.exports = async ( file, callback ) => {
146146
const extension = path.extname( file );
147147
const task = BUILD_TASK_BY_EXTENSION[ extension ];
148-
if ( task ) {
149-
await task( file );
148+
149+
if ( ! task ) {
150+
return;
150151
}
151152

152-
callback();
153+
try {
154+
await task( file );
155+
callback();
156+
} catch ( error ) {
157+
callback( error );
158+
}
153159
};

bin/packages/build.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-console */
2+
13
/**
24
* External dependencies
35
*/
@@ -65,9 +67,13 @@ let ended = false,
6567
complete = 0;
6668

6769
stream
68-
.on( 'data', ( file ) => worker( file, () => {
70+
.on( 'data', ( file ) => worker( file, ( error ) => {
6971
onFileComplete();
7072

73+
if ( error ) {
74+
console.log( error );
75+
}
76+
7177
if ( ended && ++complete === files.length ) {
7278
workerFarm.end( worker );
7379
}

0 commit comments

Comments
 (0)