File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed
angular_devkit/build_angular/src
angular-cli-files/utilities/service-worker Expand file tree Collapse file tree 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 @@ -237,7 +237,7 @@ export function buildWebpackBrowser(
237
237
} )
238
238
. pipe (
239
239
map ( ( ) => ( { success : true } ) ) ,
240
- catchError ( ( ) => of ( { success : false } ) ) ,
240
+ catchError ( error => of ( { success : false , error : mapErrorToMessage ( error ) } ) ) ,
241
241
) ;
242
242
} else {
243
243
return of ( { success } ) ;
@@ -252,7 +252,10 @@ export function buildWebpackBrowser(
252
252
resolve ( root , normalize ( options . outputPath ) ) ,
253
253
options . baseHref || '/' ,
254
254
options . ngswConfigPath ,
255
- ) . then ( ( ) => ( { success : true } ) , ( ) => ( { success : false } ) ) ) ;
255
+ ) . then (
256
+ ( ) => ( { success : true } ) ,
257
+ error => ( { success : false , error : mapErrorToMessage ( error ) } ) ,
258
+ ) ) ;
256
259
} else {
257
260
return of ( buildEvent ) ;
258
261
}
@@ -267,4 +270,16 @@ export function buildWebpackBrowser(
267
270
) ;
268
271
}
269
272
273
+ function mapErrorToMessage ( error : unknown ) : string | undefined {
274
+ if ( error instanceof Error ) {
275
+ return error . message ;
276
+ }
277
+
278
+ if ( typeof error === 'string' ) {
279
+ return error ;
280
+ }
281
+
282
+ return undefined ;
283
+ }
284
+
270
285
export default createBuilder < json . JsonObject & BrowserBuilderSchema > ( buildWebpackBrowser ) ;
You can’t perform that action at this time.
0 commit comments