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<
270270 } ,
271271 ) ;
272272
273- const result = await run . output . toPromise ( ) ;
273+ const { error , success } = await run . output . toPromise ( ) ;
274274 await run . stop ( ) ;
275275
276- return result . success ? 0 : 1 ;
276+ if ( error ) {
277+ this . logger . error ( error ) ;
278+ }
279+
280+ return success ? 0 : 1 ;
277281 }
278282 }
279283
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ export async function augmentAppWithServiceWorker(
102102 if ( ! configExists ) {
103103 throw new Error ( tags . oneLine `
104104 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
106106 in your angular.json configuration file.
107107 ` ) ;
108108 }
Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ export function buildWebpackBrowser(
261261 } )
262262 . pipe (
263263 map ( ( ) => ( { success : true } ) ) ,
264- catchError ( ( ) => of ( { success : false } ) ) ,
264+ catchError ( error => of ( { success : false , error : mapErrorToMessage ( error ) } ) ) ,
265265 ) ;
266266 } else {
267267 return of ( { success } ) ;
@@ -276,7 +276,10 @@ export function buildWebpackBrowser(
276276 resolve ( root , normalize ( options . outputPath ) ) ,
277277 options . baseHref || '/' ,
278278 options . ngswConfigPath ,
279- ) . then ( ( ) => ( { success : true } ) , ( ) => ( { success : false } ) ) ) ;
279+ ) . then (
280+ ( ) => ( { success : true } ) ,
281+ error => ( { success : false , error : mapErrorToMessage ( error ) } ) ,
282+ ) ) ;
280283 } else {
281284 return of ( buildEvent ) ;
282285 }
@@ -291,4 +294,16 @@ export function buildWebpackBrowser(
291294 ) ;
292295}
293296
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+
294309export default createBuilder < json . JsonObject & BrowserBuilderSchema > ( buildWebpackBrowser ) ;
You can’t perform that action at this time.
0 commit comments