File tree 3 files changed +24
-5
lines changed
angular_devkit/build_angular/src
angular-cli-files/utilities/service-worker
3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -270,10 +270,14 @@ export abstract class ArchitectCommand<
270
270
} ,
271
271
) ;
272
272
273
- const result = await run . output . toPromise ( ) ;
273
+ const { error , success } = await run . output . toPromise ( ) ;
274
274
await run . stop ( ) ;
275
275
276
- return result . success ? 0 : 1 ;
276
+ if ( error ) {
277
+ this . logger . error ( error ) ;
278
+ }
279
+
280
+ return success ? 0 : 1 ;
277
281
}
278
282
}
279
283
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ export async function augmentAppWithServiceWorker(
102
102
if ( ! configExists ) {
103
103
throw new Error ( tags . oneLine `
104
104
Error: Expected to find an ngsw-config.json configuration
105
- file in the ${ appRoot } folder. Either provide one or disable Service Worker
105
+ file in the ${ getSystemPath ( appRoot ) } folder. Either provide one or disable Service Worker
106
106
in your angular.json configuration file.
107
107
` ) ;
108
108
}
Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ export function buildWebpackBrowser(
261
261
} )
262
262
. pipe (
263
263
map ( ( ) => ( { success : true } ) ) ,
264
- catchError ( ( ) => of ( { success : false } ) ) ,
264
+ catchError ( error => of ( { success : false , error : mapErrorToMessage ( error ) } ) ) ,
265
265
) ;
266
266
} else {
267
267
return of ( { success } ) ;
@@ -276,7 +276,10 @@ export function buildWebpackBrowser(
276
276
resolve ( root , normalize ( options . outputPath ) ) ,
277
277
options . baseHref || '/' ,
278
278
options . ngswConfigPath ,
279
- ) . then ( ( ) => ( { success : true } ) , ( ) => ( { success : false } ) ) ) ;
279
+ ) . then (
280
+ ( ) => ( { success : true } ) ,
281
+ error => ( { success : false , error : mapErrorToMessage ( error ) } ) ,
282
+ ) ) ;
280
283
} else {
281
284
return of ( buildEvent ) ;
282
285
}
@@ -291,4 +294,16 @@ export function buildWebpackBrowser(
291
294
) ;
292
295
}
293
296
297
+ function mapErrorToMessage ( error : unknown ) : string | undefined {
298
+ if ( error instanceof Error ) {
299
+ return error . message ;
300
+ }
301
+
302
+ if ( typeof error === 'string' ) {
303
+ return error ;
304
+ }
305
+
306
+ return undefined ;
307
+ }
308
+
294
309
export default createBuilder < json . JsonObject & BrowserBuilderSchema > ( buildWebpackBrowser ) ;
You can’t perform that action at this time.
0 commit comments